Kotonga modèle ya régression ya zamba aléatoire pona ko prédire ba prix ya ba ndaku na kotalaka ba données oyo epesami.
Pona kotonga modèle ya régression ya zamba ya pamba pamba pona ko prédire ba prix ya bandako, esengeli tobongisa ba données pe tosala ba étapes oyo : 1. Ko kotisa ba bibliothèques oyo esengeli : ```python from sklearn.ensemble import RandomForestRegressor from sklearn.model_selection import train_test_split import numpy lokola np ``` 2. Kobongisa pe kobongisa ba données: ```python # Ya liboso, tobongoli ba données ya entrée na format ya malamu data = np.array([[3602, 3, 1, 3, 17, 207000, 6380], [2375, 2, 1, 2, 27, 152000, 3900], [1360, 2, 1, 2, 21, 55000, 4180], [1800, 4, 2, 3, 30, 115000, 5350]. ]) # Na sima, tokaboli ba données na ba fonctionnalités na ba étiquettes X = données[:, :-1] # ba colonne nionso sauf oyo ya suka y = données[:, -1] # colonne ya suka # Mpe sikoyo, tokaboli ya biso ba données na kati ya ba ensembles ya formation pe ya test X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=0) ``` 3. Tongela modèle: ```python # Kosala objet régresseur ya zamba ya pamba pamba rf = RandomForestRegressor(n_estimators=100, random_state=0) # Kopesa formasyo na modèle na kosalelaka ensemble ya formation rf.fit(X_train, y_train) ```` 4. Tala modèle: ```python # Kosakola ba prix ya ndaku na kosalelaka ensemble ya test y_pred = rf.predict(X_test) # Tala modèle na kosalelaka moyenne ya erreur absolue oyo euti na sklearn.metrics import mean_absolute_error mae = moyenne_absolute_error(y_test, y_pred) print(f'Moyenne ya erreur absolu: {mae}') ```` Note: Oyo ezali kaka ndakisa ya pete ya ndenge ya kotonga modèle ya régression ya zamba ya pamba pamba na kosalelaka ensemble ya ba données ya moke. Pona ba prédictions ya sikisiki, ezali recommandé kosalela ensemble ya ba données ya munene pe ya représentant, pe ko affiner ba hyperparamètres ya modèle.