Machine Learning-modellen ontwikkelen voor productie
Sinan Ozdemir
Data Scientist, Entrepreneur, and Author
Schemavertests controleren verwachte dataformaten en datatypes
Tools zoals Great Expectations automatiseren dit proces


Setup:
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from sklearn.inspection import permutation_importance
# Train a random forest classifier (assuming we have some data)
model = RandomForestClassifier().fit(X_train, y_train)
Onze permutation-importance-test uitvoeren:
# Calculate feature importances using permutation importance
results = permutation_importance(model, X_test, y_test, n_repeats=10, random_state=42)
# Print the feature importances
feature_names = ['feature_1', 'feature_2', 'feature_3', ...]
importances = results.importances_mean
for i in range(len(feature_names)):
print(f'{feature_names[i]}: {importances[i]}')
Machine Learning-modellen ontwikkelen voor productie