Permalink
Browse files

view the feature importances as a list instead of JavaArray (#417)

  • Loading branch information...
imatiach-msft authored and mhamilton723 committed Oct 30, 2018
1 parent dca5936 commit 9060406720d989557e98ce4c6d7e0c6615e79292
@@ -98,6 +98,22 @@
"model = LightGBMRegressionModel.loadNativeModelFromFile(\"mymodel\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"View the feature importances of the trained model."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"print(model.getFeatureImportances())"
]
},
{
"cell_type": "markdown",
"metadata": {},
@@ -60,6 +60,6 @@ def loadNativeModelFromString(model, labelColName="label",
def getFeatureImportances(self, importance_type="split"):
"""
Get the feature importances. The importance_type can be "split" or "gain".
Get the feature importances as a list. The importance_type can be "split" or "gain".
"""
return self._java_obj.getFeatureImportances(importance_type)
return list(self._java_obj.getFeatureImportances(importance_type))
@@ -56,6 +56,6 @@ def loadNativeModelFromString(model, labelColName="label", featuresColName="feat
def getFeatureImportances(self, importance_type="split"):
"""
Get the feature importances. The importance_type can be "split" or "gain".
Get the feature importances as a list. The importance_type can be "split" or "gain".
"""
return self._java_obj.getFeatureImportances(importance_type)
return list(self._java_obj.getFeatureImportances(importance_type))

0 comments on commit 9060406

Please sign in to comment.