Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

skimage / sklearn / dask blogpost on neurofinder data #22

Open
TomAugspurger opened this issue Jun 27, 2018 · 0 comments
Open

skimage / sklearn / dask blogpost on neurofinder data #22

TomAugspurger opened this issue Jun 27, 2018 · 0 comments

Comments

@TomAugspurger
Copy link

@jakirkham I think things are (finally) ready on the Dask side to start on this blogpost.

My basic plan was

  1. Load neurofinder into a Dask array
  2. Use skimage to do the pre-processing (help?)
  3. Fit an Incremental(MiniBatchDictionaryLearning) model

While doing 3, only one core on the cluster will be active. We would ideally wrap that Incremental in a GridSearchCV. However, MiniBatchDictionaryLearning doesn't have a score method. Is something like the following reasonable?

from sklearn.decomposition import MiniBatchDictionaryLearning


class ScorableDictionaryLearning(MiniBatchDictionaryLearning):
    
    def predict(self, X):
        code = self.transform(X)
        return code.dot(self.components_)
    
    def score(self, X, y=None):
        if isinstance(X, np.ndarray):
            scoring = np.linalg.norm
        else:
            scoring = da.linalg.norm
        if y is None:
            y = X
            
        return dask.compute(scoring(self.predict(X) - y))[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant