Code Monkey home page Code Monkey logo

Comments (8)

sgbaird avatar sgbaird commented on June 8, 2024

It's probably an issue with the save and load method, as I haven't tested this too extensively (and ran into issues specific to pytest). I'll take a look.

from mat_discover.

sgbaird avatar sgbaird commented on June 8, 2024

Note that some of the attributes are assigned during predict, and in the current implementation, mat_discover can't be used on new data due to use of "precomputed" distance matrices calculated during predict. This hasn't been a major hindrance for me since it runs fairly quickly on a GPU, and even a CPU for moderate-sized dataset (e.g. 10k points). This is on my to-do list, so if it's a major setback for you I can take another stab sooner.

from mat_discover.

sgbaird avatar sgbaird commented on June 8, 2024

Did you run disc.predict before running into this error? I probably need to add a useful warning for this for most of the subfunctions like the ones you called. If that's not the issue, then that changes things.

from mat_discover.

ancarnevali avatar ancarnevali commented on June 8, 2024

ok that was pretty dumb on my side, I didn't define the loaded model like d = disc.load(path). Doing this loads the indicated model, and the methods I mentioned above work with the exception of cluster_avg, that gives [TypeError: 'numpy.ndarray' object is not callable](). Running disc.predict doesn't seem to affect the load method.

Interestingly though, if I try to load a model I fitted on Google Colab, the loading doesn't always work. Most of the times it returns [ModuleNotFoundError: No module named 'crabnet.model'](), even though I download the disc.pkl file as it is from the Colab folder through Drive. I'll try to get some more information about this problem.

from mat_discover.

sgbaird avatar sgbaird commented on June 8, 2024

ok that was pretty dumb on my side, I didn't define the loaded model like d = disc.load(path). Doing this loads the indicated model, and the methods I mentioned above work with the exception of cluster_avg, that gives [TypeError: 'numpy.ndarray' object is not callable](). Running disc.predict doesn't seem to affect the load method.

No worries. Ok, yeah I'll need to check into why that is for cluster_avg.

Interestingly though, if I try to load a model I fitted on Google Colab, the loading doesn't always work. Most of the times it returns [ModuleNotFoundError: No module named 'crabnet.model'](), even though I download the disc.pkl file as it is from the Colab folder through Drive. I'll try to get some more information about this problem.

I ran into this issue before and couldn't figure it out at the time, so I opened it in a separate GitHub issue before.

from mat_discover.

sgbaird avatar sgbaird commented on June 8, 2024

See #39

from mat_discover.

sgbaird avatar sgbaird commented on June 8, 2024

@ancarnevali The issue is probably a difference in mat_discover versions. When I bumped from version 1 to version 2, I replaced crabnet.model with crabnet.crabnet_ and got rid of train_crabnet.py. This was part of a series of changes I've been wanting to make for a long time. If you install e.g. 1.3.1 I think you will be able to load the models you fitted before. pickle is easy, but maintaining load and save version compatibility when breaking changes occur can be tough (maybe there's an easier way I'm not aware of). Let me know if there's anything you need on this front.

from mat_discover.

sgbaird avatar sgbaird commented on June 8, 2024

Btw, I checked back into cluster_avg and it looks like it's not a method, but an array that only gets assigned under certain conditions.

Condition:

if self.proxy_weight != 0 and self.novelty_learner == "discover":

# cluster-wise predicted average
cluster_pred = np.array(
[pred.ravel()[self.labels == lbl] for lbl in self.unique_labels],
dtype=object,
)
self.cluster_avg = np.vectorize(np.mean)(cluster_pred).reshape(-1, 1)

from mat_discover.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.