python/ML(14)
-
[ML_2] Let's convert pd.Dataframe to train_test dataset.
What if our dataset is a pd.DataFrame? In this case, we convert the DataFrame into a training dataset using the following code.from sklearn.datasets import load_iris from sklearn.tree import DecisionTreeClassifier from sklearn.metrics import accuracy_score from sklearn.model_selection import train_test_split import pandas as pd iris_df = pd.DataFrame(iris_data.data, columns = iris_data.feature_n..
2025.07.10 -
[ML_1] Let's make iris classification model by Scikitlearn
First, we import the necessary modules:import sklearn from sklearn.datasets import load_iris from sklearn.tree import DecisionTreeClassifier from sklearn.model_selection import train_test_splitimport pandas as pd We start by importing the scikit-learn library (sklearn) along with the datasets module, the Decision Tree algorithm, and the train_test_split utility. We also import pandas for handlin..
2025.07.09