Comments (10)
Hi,
You can find the shapelets in the tree
attribute. forest.estimators_[0].tree.features
give a list of the shapelets of the first tree in the ensemble. Check the _tree.py file for details. The tree has the same structure as a tree in sklearn so examples for extracting features of such trees can be adapted.
from wildboar.
Thanks, I've managed to retrieve shapelets.
I have another question: the forest.estimators_[0].tree.feateures
list contains several values.
For example:
features[0] = (1, array([....]))
features[1] = None
features[2] = (1, array([....]))
features[3] = None
features[4] = None
etc...
It seems that some elements are None, while other are in the form (number, array). I think that maybe the array is the shapelet and the number is the target class.
Why are some elements None? Why does the number of elements in the list differ from a tree to another?
Thank you again!
from wildboar.
If the value is None
the node index refers to a leaf node. The first element of the tuple refers to the dimension of the input data and the second is the shapelet.
from wildboar.
The number of features depend on the depth of the tree. Not all trees are equally deep.
from wildboar.
Here is an example where all branches are visited: https://github.com/isaksamsten/wildboar/blob/9348d46422bf9665b5aa67f17aa397191764e85b/src/wildboar/explain/counterfactual/_sf.py#L71
from wildboar.
Hi @isaksamsten ,
I stumbled upon this thread while looking for similar functionality...in my own usage, I found that I was able to access the shapelets as (assuming the classifier object is called clf
and assuming the first tree at index 0):
clf.estimators_[0].estimator.tree_.shapelet
Rather than the way you described above. Is this way correct or am I missing something?
Thanks!
from wildboar.
Hi!
You are not missing anything. For version 1.1, the shapelet
attribute is renamed features.
from wildboar.
Hello!
Ah, got it. v1.1 is seemingly not on pip yet, so I'll just make a note to update my code when it comes out. Thanks for the clarification and the amazing work!
from wildboar.
Not yet. The update is rather massive and I want to make sure that there aren’t too many regressions. (I will try to write a migration guide too 😱)
from wildboar.
Haha, that's ok. Thank you once again for the amazing work!
from wildboar.
Related Issues (20)
- ShapeletForestEmbedding returns a matrix of all ones HOT 1
- RocketClassifier with n_jobs > 1 while using cross_validation does not work
- RocketClassifier predict_proba is not working
- RocketClassifier does not have a classes_-property
- 'IsolationShapeletForest' object has no attribute 'n_dims_'
- Bug when using dict or list scoring in importances
- Transform of SAX and PAA does not check if fitted
- ShapeletForestClassifier does not support single dimension 3D input (i.e. shape (10, 1, 20)) HOT 2
- Load multiple datasets with merge_train_test=False
- Support pairwise_distance(2d-array, 3d-array) HOT 2
- will it work for windows ? HOT 3
- you request scikit-learn>=1.2rc1,<1.3a0 but pip install -U wildboar installs very old scikit-learn-1.1.3 HOT 4
- Assigned leaf node in decision_path() HOT 2
- Unecessary splits in shapele trees
- CI builds fail on Windows.
- Raises ModuleNotFoundError when importing the datasets module
- Update What's New for Version 1.2
- _check_estimator_name no longer included in sklearn.utils.validation HOT 12
- Timeout too low
- Unstable sort results in failing test with Numpy 2.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wildboar.