Code Monkey home page Code Monkey logo

scipr's People

Contributors

amiralavi avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

doraadong

scipr's Issues

Add tensorboard logging

Add tensorboard writers. Tensorboard is included in one of our dependencies, pytorch, so it makes sense to interact with it through pytorch.

Add arguments to the SCIPR.fit function:

  • tensorboard=True; enable tensorboard logging
  • tensorboard_dir=None; if specified, write tensorboard session to this directory. If not specified, warn that it's not specified and let user know what auto-generated path is being used.

On SCIPR.fit, add tensorboard tags for:

  • number of matches
  • avg distance between matches

Add AnnData input support

Add support to feed an adata object into the fit and predict functions, something like:

def fit(self, adata, batch_key, source, target)

Where batch_key is the name of the column in obsm which contains the batch annotations, and source and target are the batch annotations of the source and target batches.

def transform(self, adata, batch_key, batch, inplace=False)

batch is the batch annotation for the batch to transform. If inplace==True then replace the cells (observations) in the adata.X which have the batch annotation with the new transformed values. Otherwise, return the tuple (transformed numpy.ndarray, row indexer into adata of the transformed cells)

transform_algo = affine generates poor model.transform()

  • scipr version: 0.2.1
  • Python version: 3.9.7
  • Operating System: Mac OS Monterey

Description

Describe what you were trying to get done.
I 'd like to adapt and use scipr with flow and mass cytomtery data sets.

Tell us what happened, what went wrong, and what you expected to happen.
Using simulated data, MNN matching, and an "affine" transform, the transformed object ends up being a single point repeated N times. If I use "rigid", I get points on a curve.

What I Did

As input, I simulated a toy 2D data set containing 500 points in 4 clusters (data set "A" in the code below). Then I affine-transformed "A" and called that "B".

Paste the command(s) you ran and the output.

import scipr
from scipr.matching import Closest, Hungarian, Greedy, MNN
from scipr.transform import Affine, Rigid

closest = Closest()
MNN = MNN()
rigid = Rigid()
affine = Affine()

model = scipr.SCIPR(match_algo=MNN,
transform_algo=affine,
input_normalization='l2',
n_iter = 100)
model.fit(A, B)
aligned = model.transform(A)

I get back a single coordinate:
aligned[:5,]
array([[0.71251583, 0.68878496],
[0.71251583, 0.68878496],
[0.71251583, 0.68878496],
[0.71251583, 0.68878496],
[0.71251583, 0.68878496]])

Part of the issue is the matching. If I replace the "match_alg"o with one that just passes a predefined set of matching points, then I get back a transformed object that looks reasonably like the reference, but ONLY if the "transform_algo" is "rigid". For "affine" I get back a straight-line. Any ideas why?

THANK YOU.

Hamid

If there was a crash, please include the traceback here.

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.