Comments (3)
Thanks for the bug report. Yes, that small change would solve the issue.
from isotree.
This wasn't quite the complete solution. There's a related (and perhaps uncommon) scenario that encounters a similar bug.
When you import a saved model (extending on the example above)
iso_imp = IsolationForest.import_model('test_isolationforest', use_cpp=True)
and then re-export that same model object
iso_imp.export_model('test_isolationforest2', use_cpp=True)
the following error is thrown
TypeError Traceback (most recent call last)
<ipython-input-14-a78373200393> in <module>
----> 1 iso_imp.export_model('test_isolationforest2', use_cpp=True)
isotree/__init__.py in export_model(self, file, use_cpp)
2128 """
2129 assert self.is_fitted_
-> 2130 metadata = self._export_metadata()
2131 with open(file + ".metadata", "w") as of:
2132 json.dump(metadata, of, indent=4)
isotree/__init__.py in _export_metadata(self)
2363 "cat_levels" : [list(m) for m in self._cat_mapping],
2364 "categ_cols" : [] if self.categ_cols is None else list(self.categ_cols),
-> 2365 "categ_max" : list(self._cat_max_lev)
2366 }
2367
TypeError: 'NoneType' object is not iterable
I was able to resolve by replacing like 2365 with
"categ_max" : [] if self._cat_max_lev is None else list(self._cat_max_lev)
But again I'll leave it to you to decide if this is functionality you wish to support and to determine if this is the correct solution (I think there are a few different ways of handling).
Thanks for the great work on this research and this library!
from isotree.
Thanks again. That should solve it, but I've added a couple extra checks just in case.
from isotree.
Related Issues (20)
- isolation.forest() is not reproducible whenever `nthreads > 1` HOT 13
- Error in fit_model(pdata$X_num, pdata$X_cat, unname(pdata$ncat), pdata$Xc, : std::bad_alloc HOT 3
- De-serialized Tree estimators in R HOT 1
- module 'numpy.random' has no attribute 'Generator' HOT 1
- Not able to run a loop in parallel using joblib HOT 2
- Problem with saving trained isolation forest when `categ_cols` is not None. HOT 6
- Question on the anomaly score result: which column (attribute) contributes the most? HOT 1
- Difficulty installing Isotree for R on Linux HOT 7
- Question: When categorical attributes are split into subsets, are the subsets random? HOT 2
- What is equivalent to contamination parameter in sklearn? HOT 1
- Mac arm nthreads problem HOT 1
- Error when using fit() and build_imputer=True is misleading HOT 2
- Same category is always imputed when enough trees are grown HOT 3
- pip install issue: cc1plus no such file or directory HOT 5
- pip install issue not fixed but closed HOT 1
- Reproductibility problems with Extented Isolation Forest HOT 8
- How to re-train when a few values are marked as anomalies when they should not have been? HOT 3
- Isotree Isolation forest generating large model pickle file HOT 3
- Training Isotree with Python on Windows then Deserializing with C++ on Raspberry Pi 3B+ (Linux) HOT 7
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 isotree.