glotzerlab / dupin Goto Github PK
View Code? Open in Web Editor NEWPackage for detecting rare events in molecular simulations.
License: BSD 3-Clause "New" or "Revised" License
Package for detecting rare events in molecular simulations.
License: BSD 3-Clause "New" or "Revised" License
supervised.Window.compute bug when converting and checking input array type (https://github.com/glotzerlab/dupin/blob/main/dupin/preprocessing/supervised.py?plain=1#L215). When lines 215 and 216 are deleted the code works as expected. The type checking might be off in terms of wrong pandas type or string quotations should be removed?
import dupin as du
import sklearn as sk
import numpy as np
data = [4,5,8,1,4,2,6,8,23,5432,76,23,4,2,6,7,3,4,6,3,4,67,3,4,6,3,4,6,6,3,5,7,45,2,5]
decision_tree = sk.tree.DecisionTreeClassifier(max_depth=1)
window = du.preprocessing.supervised.Window(
classifier=decision_tree, window_size=10, test_size=0.5,
n_classifiers=50, combine_errors="mean"
)
data = np.asarray(data).reshape(-1,1)
errors = window.compute(data)
File ~/CODE/GLOTZERLAB/dupin/dupin/preprocessing/supervised.py:215, in Window.compute(self, X)
[213](file:///home/domi/CODE/GLOTZERLAB/dupin/dupin/preprocessing/supervised.py?line=212) self.classifiers_ = []
[214](file:///home/domi/CODE/GLOTZERLAB/dupin/dupin/preprocessing/supervised.py?line=213) y = np.repeat([0, 1], np.ceil(self.window_size / 2))[: self.window_size]
--> [215](file:///home/domi/CODE/GLOTZERLAB/dupin/dupin/preprocessing/supervised.py?line=214) if isinstance(X, "pandas.core.frame.DataFrame"):
[216](file:///home/domi/CODE/GLOTZERLAB/dupin/dupin/preprocessing/supervised.py?line=215) X = X.to_numpy()
[217](file:///home/domi/CODE/GLOTZERLAB/dupin/dupin/preprocessing/supervised.py?line=216) shuffle_splits = sk.model_selection.StratifiedShuffleSplit(
[218](file:///home/domi/CODE/GLOTZERLAB/dupin/dupin/preprocessing/supervised.py?line=217) n_splits=self.n_classifiers, test_size=self.test_size
[219](file:///home/domi/CODE/GLOTZERLAB/dupin/dupin/preprocessing/supervised.py?line=218) )
TypeError: isinstance() arg 2 must be a type, a tuple of types, or a union
Overail complexity of using this is quite high. We should have a simple example that is super easy to use and understand. one that possibly can be put on front page
SOLUTION:
we will make several how to's that teach how to use custom functions with examples:
CostLinearBiasedFit doesn't work with single signal type.
import numpy as np
import dupin as du
import ruptures as rpt
dl=np.asarray([1,1,1,1,1,1,0,0,0,0])
#dl = du.preprocessing.signal.moving_average(dl,3)
lin_regress_cost = du.detect.offline.CostLinearBiasedFit()
dynp = rpt.Dynp(custom_cost=lin_regress_cost)
sweep_detector = du.detect.offline.SweepDetector(dynp, max_change_points=6)
change_points = sweep_detector.fit(dl)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.