Malignant or Bening?

Working on Machine Learning as a Complete Beginner

Our ML Toolbox

6 Main steps

ML libraries

ML Models

The challenge

Simple project

0. Data and notebooks

It’s literally this simple 😅

1. Import the data

import pandas as pd
import pandas as pd
df = pd.read_csv(‘music.csv’)

2. Prepare the data

X = df.drop(columns=[‘genre’])
y = df[‘genre’]

3. Training and testing sets

from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)

4. Choose a model

5. Train & make predictions

from sklearn.tree import DecisionTreeClassifier
model = DecisionTreeClassifier(), y_train)

6. Test & tune

predictions = model.predict(X_test)
from sklearn.metrics import accuracy_score
accuracy.score(y_test, predictions)

More complex project

Data and libraries

df = df.dropna(axis=1)

Manipulating the data

LabelEncoder_Y = LabelEncoder()
df.iloc[:,1] = LabelEncoder_Y.fit_transform(df.iloc[:,1].values)
X = df.iloc[:,2:31].values
y = df.iloc[:,1].values

More models

#1 Logistic regression
from sklearn.linear_model import LogisticRegression
log = LogisticRegression(random_state = 0), y_train)
#2 Decission tree
from sklearn.tree import DecisionTreeClassifier
tree = DecisionTreeClassifier(criterion = ‘entropy’, random_state = 0), y_train)
#3 Random forest
from sklearn.ensemble import RandomForestClassifier
forest = RandomForestClassifier(n_estimators = 10, criterion=’entropy’, random_state=0), y_train)

Bye & build


Ambitious teenager building innovative projects with Synthetic Biology and Artificial Intelligence

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store