🚀
K Nearest Neighbors
Knn Classification
++++
Data Science
May 2026×Notebook lesson

Notebook converted from Jupyter for blog publishing.

KNN-Classification

Driptanil Datta
Driptanil DattaSoftware Developer
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
df = pd.read_csv('../DATA/gene_expression.csv')
df.head()
HTML
MORE
Gene One
Gene Two
Cancer Present
0
4.3
sns.scatterplot(x='Gene One', y='Gene Two', hue='Cancer Present', data=df, alpha=0.6)
RESULT
<Axes: xlabel='Gene One', ylabel='Gene Two'>
PLOT
Output 1
sns.scatterplot(x='Gene One',y='Gene Two',hue='Cancer Present',data=df, alpha=0.6)
 
plt.xlim(2,6)
plt.ylim(3,10)
RESULT
(3.0, 10.0)
PLOT
Output 2
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
X = df.drop('Cancer Present',axis=1)
y = df['Cancer Present']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42)
scaler = StandardScaler()
Drip

Driptanil Datta

Software Developer

Building full-stack systems, one commit at a time. This blog is a centralized learning archive for developers.

Legal Notes
Disclaimer

The content provided on this blog is for educational and informational purposes only. While I strive for accuracy, all information is provided "as is" without any warranties of completeness, reliability, or accuracy. Any action you take upon the information found on this website is strictly at your own risk.

Copyright & IP

Certain technical content, interview questions, and datasets are curated from external educational sources to provide a centralized learning resource. Respect for original authorship is maintained; no copyright infringement is intended. All trademarks, logos, and brand names are the property of their respective owners.

System Operational

© 2026 Driptanil Datta. All rights reserved.