MLeap Scikit Example Broken
See original GitHub issueHi, I tried to get the Scikit-learn example from the documentation to work
# Initialize a FeatureExtractor, which subselects only the features we want
# to run the Standard Scaler against
input_features = ['a', 'c', 'd']
output_vector_name = 'unscaled_continuous_features' # Used only for serialization purposes
output_features = ["{}_scaled".format(x) for x in input_features]
feature_extractor_tf = FeatureExtractor(input_scalars=input_features,
output_vector=output_vector_name,
output_vector_items=output_features)
# Define the Standard Scaler as we normally would
standard_scaler_tf = StandardScaler(with_mean=True,
with_std=True)
# Execute ML-Init to add the require attributes to the transformer object
# Op and Name will be initialized automatically
standard_scaler_tf.mlinit(prior_tf=feature_extractor_tf,
output_features='scaled_continuous_features')
But ran into the following error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-3-a38e6a0355a2> in <module>()
17 # Op and Name will be initialized automatically
18 standard_scaler_tf.mlinit(prior_tf=feature_extractor_tf,
---> 19 output_features='scaled_continuous_features')
/Users/avd/anaconda/envs/py35_auto_/lib/python3.5/site-packages/mleap/sklearn/preprocessing/data.py in mleap_init(self, prior_tf, output_features)
88 output_feature_name = prior_tf.output_features
89
---> 90 class_name = "{}".format(self.__init__.im_class).split('.')[-1].replace('>','').replace("'",'')
91
92 if output_features is not None:
AttributeError: 'function' object has no attribute 'im_class'
Any suggestions?
AirBnb price regression example breaks due to the same error.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:10 (2 by maintainers)
Top Results From Across the Web
MLeap broken with Skicit-learn when serialising: object has ...
1 Answer 1 ... I found the solution. ... was missing. You can also use a pipeline to do that: from mleap.sklearn.logistic import...
Read more >combust/mleap - Scaladex
MLeap allows data scientists and engineers to deploy machine learning pipelines from Spark and Scikit-learn to a portable format and execution engine.
Read more >combust/mleap - Gitter
I had to migrate to sbt 1.+ recently in order to enable a scalapb/java upgrade (combust/mleap#818) and it looks like something broke in...
Read more >MLeap Model Export Demo (Python) - Databricks
MLeap is a common serialization format and execution engine for machine learning pipelines. It supports Apache Spark, scikit-learn, and TensorFlow for ...
Read more >Source code for mlflow.mleap
NOTE: You cannot load the MLeap model flavor in Python; you must download it ... code-block:: python :caption: Example import mlflow import mlflow.mleap...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@donigian @MTDzi Yes, @ksoucy is right, we merged https://github.com/combust/mleap/pull/344 in order to make mleap scikit-learn work with python 3.
I’ll try to get a new version of the package published to pypi so that you don’t need to rebuild from source.
I experienced the same issue, it looks related to changes made in #344 which were merged to master.
If you change line 90 in your local /Users/avd/anaconda/envs/py35_auto_mrm/lib/python3.5/site-packages/mleap/sklearn/preprocessing/data.py file, to match the master branch, the demo notebook works:
Alternatively, you could also rebuild from source from the current master branch.