 Bosala modèle ya classifcation pona koyeba soki mammifère oyo epesami ezali carnivore to herbivore.
Mpo na koyeba soki nyama oyo ememaka mabɛlɛ oyo epesami ezali nyama oyo elyaka misuni to elyaka matiti, tokoki kosalela modèle ya classification. Modèle oyo ekoki kozala fondés na ba éléments mpe ba caractéristiques ndenge na ndenge ya ba mammifères, lokola ba attributs physiques na bango, ba habitations na bango, na ba aliments na bango. Tala ndakisa ya ndenge nini tokoki kosala modèle oyo ya classification na kosalelaka `DecisionTreeClassifier` uta na bibliothèque `scikit-learn` na Python. ```python uta na sklearn.tree import DecisionTreeClassifier # kosala ensemble ya ba données na ba éléments ya ba mamans na ba étiquettes na bango oyo ekokani mammals = [ {'kombo': 'nkosi', 'mino': 'sharp', 'habitat': 'savannah'}, {'kombo': 'gazelle', 'mino': 'plat', 'esika ya bofandi': 'savannah'}, {'kombo': 'panda', 'mino': 'plat', 'esika ya bofandi': 'zamba'. }, {'kombo': 'tigre', 'mino': 'ya makasi', 'esika ya kofanda': 'zamba'} ] labels = ['eloko oyo elyaka misuni', 'eloko oyo elyaka matiti', 'eloko oyo elyaka matiti', 'eloko oyo elyaka misuni'] # create the ba ensembles ya ba données ya fonctionnalité na cible features = [[mammal['teeth'] == 'sharp', mammal['habitat'] == 'savannah'] pona mammifère na ba mammifères] cible = [étiquette == 'carnivore' pona étiquette na ba étiquettes ]. nyama oyo elyaka misuni to nyama oyo elyaka matiti. ```python # kosala ensemble ya ba données mpo na Fennec Fox fennec_fox = {'kombo': 'fennec fox', 'mino': 'sharp', 'habitat': 'desert'} fennec_features = [fennec_fox['mino'] = = 'sharp', fennec_fox['habitat'] == 'savannah'] # sala prédiction na kosalelaka modèle ya classification is_carnivore = clf.predict([fennec_features])[0] diet = 'carnivore' soki is_carnivore else 'herbivore' imprimer (f"Fennec Fox ezali {diet}.") ``` Na kotalaka modèle na biso ya classification, Fox Fennec elingaki kozala classifié lokola carnivore. Kasi, banyama oyo esalemaka mbala na mbala