मॉडल को समझना, सेव करना और लोड करना

PySpark के साथ Feature Engineering

John Hogue

Lead Data Scientist, General Mills

मॉडल को समझना

import pandas as pd
# फीचर इम्पॉर्टेंस को pandas कॉलम में बदलें
fi_df = pd.DataFrame(model.featureImportances.toArray(), 
                     columns=['importance'])
# फीचर नामों की सूची को pandas कॉलम में बदलें
fi_df['feature'] = pd.Series(feature_cols)
# फीचर इम्पॉर्टेंस के आधार पर डेटा sort करें
fi_df.sort_values(by=['importance'], ascending=False, inplace=True)
PySpark के साथ Feature Engineering

मॉडल को समझना

# परिणाम समझें
model_df.head(9)
|          feature        |importance|
|-------------------------|----------|
| LISTPRICE               | 0.312101 |
| ORIGINALLISTPRICE       | 0.202142 |
| LIVINGAREA              | 0.124239 |
| SQFT_TOTAL              | 0.081260 |
| LISTING_TO_MEDIAN_RATIO | 0.075086 |
| TAXES                   | 0.048452 |
| SQFTABOVEGROUND         | 0.045859 |
| BATHSTOTAL              | 0.034397 |
| LISTING_PRICE_PER_SQFT  | 0.018253 |
PySpark के साथ Feature Engineering

मॉडल सेव करना और लोड करना

# मॉडल सेव करें
model.save('rfr_real_estate_model')
from pyspark.ml.regression import RandomForestRegressionModel

# मॉडल लोड करें
model2 = RandomForestRegressionModel.load('rfr_real_estate_model')
PySpark के साथ Feature Engineering

अब आपके अंतिम अभ्यास की बारी!

PySpark के साथ Feature Engineering

Preparing Video For Download...