Machine Learning - Selected Assignments

Leadership - Artifact 4

EDTECH 597 Jupyter Leadership Machine Learning Python

2 minutes

I would be remiss not to include an artifact from my favorite course in the program. Introduction to Machine Learning Education (EDTECH 597) provided an excellent introduction to machine learning and data analysis using Python, Orange, and Jupyter Notebooks. The artifact linked below is from an exercise later in the course where various machine learning models were applied to a dataset and evaluated. Further below is a representative output from a Jupyter notebook used in the course. Machine learning is one of the most interesting applications of artificial intelligence (AI) in education with the recent exception of generative AI and large language models (LLMs).

The lessons provided from this course provided a springboard from which I was able to extend my knowledge of Python and data analysis to pursue an entirely different career. I use these tools on a daily basis as a test engineer.

Selected Machine Learning Assignment


#import necessary packages
import pandas as pd #import pandas 
from sklearn.cluster import KMeans #import kmeans 
import matplotlib.pyplot as plt #import matplotlib for data visualization
import warnings #ignore general warnings
warnings.filterwarnings("ignore")
df = pd.read_csv('log_processed.csv') #import processed data
#group students based on their learning behaviors. Therefore, keep learning behavior related variables
df1=df[['content_access', 'assessment_access', 'interaction_frequency', 'check_grade', 'others']] 
df1 #print df1

content_accessassessment_accessinteraction_frequencycheck_gradeothers
0247.0144.069.075.020.0
1797.0209.0146.0141.0139.0
2455.01067.0193.0119.032.0
3745.0173.099.0176.050.0
4473.0167.049.0152.055.0
..................
67430.020.00.00.00.0
67442.00.00.00.00.0
67450.00.03.00.00.0
67460.03.00.00.00.0
67470.02.00.00.00.0

6748 rows × 5 columns

ks = range(1,10) #test clustering from 1 9 clusters 1-9
inertias = []
for k in ks:
    model = KMeans(n_clusters=k) 
    model.fit(df1) # put your dataset here for running the clustering analysis
    inertias.append(model.inertia_) #append inertia_value to the list. 
    #The value is the squared sum of distance between individual points with its cluster's centroid. 
    #Smaller value => lower squared sum of distance with individual clusters. 

plt.figure(figsize=(10,8)) #Figure size
plt.plot(ks,inertias,'-o',color='g') # x, y,style,color
plt.xlabel('number of clusters, k',size=15) #x label
plt.ylabel('inertia',size=15) #y label
plt.xticks(ks) # ticks on the X axis
plt.show() #Plot
K-Means Clusters Plot