Project - CSF344 and CSN344-Machine Learning
Project - CSF344 and CSN344-Machine Learning
Instructions
There are two questionsin this assignment.
Email/paper/other modes of submissions will not be accepted.
Upload a word version of this document.
Assignment submitted after due date will not be evaluated and a score of zero will
be awarded.
Plagiarism may lead to award of zero marks.
You will submit (upload) this assignment in MS Teams. Name this document as
GLA1_AJPODD2024_John_Doe.doc in case your name is John Doe, and this graded lab
assignment is 1 of course whose acronym is AJP, and offered in ODD 2024. Paste your
codeafter each question, paste the screenshot of output, save and upload the document.
Question 1:
Create an ML model using any one of the algorithms given below.
i. Decision Tree
ii. Random Forest
iii. Support Vector Machine
file_path = "Iris.csv"
data = pd.read_csv(file_path)
le = LabelEncoder()
data['Species'] = le.fit_transform(data['Species'])
X = data.drop(columns=["Species"])
y = data["Species"]
scaler = StandardScaler()
X_scaled = scaler.fit_transform(X)
model = LogisticRegression(max_iter=500)
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
print("Confusion Matrix:")
print(conf_matrix)
print("\nAccuracy:", accuracy)
print("F1-Score:", f1)
print("Precision:", precision)
Project – CSF344, Machine Learning, ODDSem, III Year
Output: