skklearn-lab-tools 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sriram
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM OF LIABILITY, WHETHER IN
19
+ AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,126 @@
1
+ Metadata-Version: 2.4
2
+ Name: skklearn-lab-tools
3
+ Version: 0.1.0
4
+ Summary: An educational collection of ten Python machine learning and data analysis programmes.
5
+ Author: Sriram
6
+ License-Expression: MIT
7
+ Keywords: machine-learning,education,syllabus,data-analysis,skklearn
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Education
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Topic :: Education
12
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: pandas
17
+ Requires-Dist: numpy
18
+ Requires-Dist: scikit-learn
19
+ Requires-Dist: matplotlib
20
+ Requires-Dist: seaborn
21
+ Requires-Dist: scipy
22
+ Requires-Dist: statsmodels
23
+ Dynamic: license-file
24
+
25
+ # skklearn
26
+
27
+ An educational source-code library of ten Python machine learning and data analysis syllabus programmes.
28
+
29
+ > **Disclaimer:** `skklearn` is an independent educational package and is **not affiliated with or endorsed by scikit-learn**.
30
+
31
+ ---
32
+
33
+ ## 🎯 Purpose
34
+
35
+ `skklearn` allows students and lab instructors to install the package, view the exact original source code of any syllabus programme directly in Python IDLE or the terminal, and copy it into a new `.py` file to work with in the lab.
36
+
37
+ **Key Design Principles:**
38
+ - **Source Code Library**: Designed to display and copy unmodified source code, not automatically execute it.
39
+ - **Zero Bundled Datasets**: No CSV files or datasets are included in the package.
40
+ - **Exact Code Preservation**: All 10 original programmes are preserved byte-for-byte with their original variable names, logic, and file paths.
41
+
42
+ ---
43
+
44
+ ## πŸ’» Installation
45
+
46
+ Install `skklearn` using `pip`:
47
+
48
+ ```bash
49
+ py -m pip install skklearn
50
+ ```
51
+
52
+ Or install locally from the built wheel:
53
+
54
+ ```bash
55
+ py -m pip install dist/skklearn-0.1.0-py3-none-any.whl
56
+ ```
57
+
58
+ ---
59
+
60
+ ## πŸš€ How to Use in the College Lab / Python IDLE
61
+
62
+ ### Step 1: Open Python IDLE or Interactive Shell
63
+
64
+ Import `skklearn` and call `show_code(program_number)`:
65
+
66
+ ```python
67
+ import skklearn
68
+
69
+ # Display Programme 1 (Find-S Algorithm)
70
+ skklearn.show_code(1)
71
+ ```
72
+
73
+ The exact source code will print directly in your IDLE Shell.
74
+
75
+ ### Step 2: Copy Code into a New File
76
+ 1. In Python IDLE, highlight and copy the printed code.
77
+ 2. Select **File > New File** (`Ctrl + N`).
78
+ 3. Paste the code into your new editor window.
79
+ 4. Save the file (e.g., `lab_prog1.py`).
80
+
81
+ ### Step 3: Set Up Required Datasets (If Applicable)
82
+ For programmes that use external CSV files, create the dataset at the path hardcoded in the original syllabus programme (see table below).
83
+
84
+ ### Step 4: Run the Programme
85
+ Press **F5** (or **Run > Run Module**) in IDLE to execute your script.
86
+
87
+ ---
88
+
89
+ ## πŸ“‹ Syllabus Programmes & Dataset Requirements
90
+
91
+ | Programme Number | Algorithm / Title | External CSV Required? | Expected Path & Format |
92
+ | :---: | :--- | :---: | :--- |
93
+ | `1` | **Find-S Algorithm** | **Yes** | Path: `E:/sriram intern/sampledataset.csv`<br>Format: CSV with header. Categorical string attributes in `iloc[:, :-1]`, target concept in `iloc[:, -1]` with `'yes'`/`'no'`. |
94
+ | `2` | **Candidate Elimination** | **Yes** | Path: `E:/sriram intern/sampledataset.csv`<br>Format: Shared with Programme 1. |
95
+ | `3` | **Decision Tree Classifier** | No | Uses built-in `sklearn.datasets.load_iris`. |
96
+ | `4` | **Multi-Layer Perceptron (MLP)** | No | Uses built-in `sklearn.datasets.load_iris`. |
97
+ | `5` | **Gaussian NaΓ―ve Bayes** | **Yes** | Path: `E:/sriram intern/datasot_5.csv`<br>Format: CSV with header. Column 0 ignored. Numeric feature columns in `iloc[:, 1:-1]`, binary target in `iloc[:, -1]`. |
98
+ | `6` | **Text Classification / Spam** | **Yes** | Path: `E:\sriram intern\downloadsss\prg6new.csv`<br>Format: CSV with header columns `text` (message string) and `label` (categories including `'spam'` and `'ham'`). |
99
+ | `7` | **t-test & One-Way ANOVA** | No | Uses built-in `seaborn.load_dataset('iris')`. |
100
+ | `8` | **Backpropagation Network** | No | Uses built-in `sklearn.datasets.load_iris`. |
101
+ | `9` | **k-Nearest Neighbors (k-NN)** | No | Uses built-in `sklearn.datasets.load_iris`. |
102
+ | `10` | **Simple Linear Regression** | No | Uses built-in `sklearn.datasets.load_diabetes`. |
103
+
104
+ ---
105
+
106
+ ## πŸ›‘οΈ Error Handling
107
+
108
+ Passing an invalid programme number (outside the range 1 to 10) raises a clear `ValueError`:
109
+
110
+ ```python
111
+ skklearn.show_code(15)
112
+ # ValueError: Invalid programme number '15'. Please choose a number from 1 to 10.
113
+ ```
114
+
115
+ ---
116
+
117
+ ## πŸ“¦ Dependencies
118
+
119
+ The package declares the third-party libraries needed when you run the copied syllabus programmes:
120
+ - `pandas`
121
+ - `numpy`
122
+ - `scikit-learn`
123
+ - `matplotlib`
124
+ - `seaborn`
125
+ - `scipy`
126
+ - `statsmodels`
@@ -0,0 +1,102 @@
1
+ # skklearn
2
+
3
+ An educational source-code library of ten Python machine learning and data analysis syllabus programmes.
4
+
5
+ > **Disclaimer:** `skklearn` is an independent educational package and is **not affiliated with or endorsed by scikit-learn**.
6
+
7
+ ---
8
+
9
+ ## 🎯 Purpose
10
+
11
+ `skklearn` allows students and lab instructors to install the package, view the exact original source code of any syllabus programme directly in Python IDLE or the terminal, and copy it into a new `.py` file to work with in the lab.
12
+
13
+ **Key Design Principles:**
14
+ - **Source Code Library**: Designed to display and copy unmodified source code, not automatically execute it.
15
+ - **Zero Bundled Datasets**: No CSV files or datasets are included in the package.
16
+ - **Exact Code Preservation**: All 10 original programmes are preserved byte-for-byte with their original variable names, logic, and file paths.
17
+
18
+ ---
19
+
20
+ ## πŸ’» Installation
21
+
22
+ Install `skklearn` using `pip`:
23
+
24
+ ```bash
25
+ py -m pip install skklearn
26
+ ```
27
+
28
+ Or install locally from the built wheel:
29
+
30
+ ```bash
31
+ py -m pip install dist/skklearn-0.1.0-py3-none-any.whl
32
+ ```
33
+
34
+ ---
35
+
36
+ ## πŸš€ How to Use in the College Lab / Python IDLE
37
+
38
+ ### Step 1: Open Python IDLE or Interactive Shell
39
+
40
+ Import `skklearn` and call `show_code(program_number)`:
41
+
42
+ ```python
43
+ import skklearn
44
+
45
+ # Display Programme 1 (Find-S Algorithm)
46
+ skklearn.show_code(1)
47
+ ```
48
+
49
+ The exact source code will print directly in your IDLE Shell.
50
+
51
+ ### Step 2: Copy Code into a New File
52
+ 1. In Python IDLE, highlight and copy the printed code.
53
+ 2. Select **File > New File** (`Ctrl + N`).
54
+ 3. Paste the code into your new editor window.
55
+ 4. Save the file (e.g., `lab_prog1.py`).
56
+
57
+ ### Step 3: Set Up Required Datasets (If Applicable)
58
+ For programmes that use external CSV files, create the dataset at the path hardcoded in the original syllabus programme (see table below).
59
+
60
+ ### Step 4: Run the Programme
61
+ Press **F5** (or **Run > Run Module**) in IDLE to execute your script.
62
+
63
+ ---
64
+
65
+ ## πŸ“‹ Syllabus Programmes & Dataset Requirements
66
+
67
+ | Programme Number | Algorithm / Title | External CSV Required? | Expected Path & Format |
68
+ | :---: | :--- | :---: | :--- |
69
+ | `1` | **Find-S Algorithm** | **Yes** | Path: `E:/sriram intern/sampledataset.csv`<br>Format: CSV with header. Categorical string attributes in `iloc[:, :-1]`, target concept in `iloc[:, -1]` with `'yes'`/`'no'`. |
70
+ | `2` | **Candidate Elimination** | **Yes** | Path: `E:/sriram intern/sampledataset.csv`<br>Format: Shared with Programme 1. |
71
+ | `3` | **Decision Tree Classifier** | No | Uses built-in `sklearn.datasets.load_iris`. |
72
+ | `4` | **Multi-Layer Perceptron (MLP)** | No | Uses built-in `sklearn.datasets.load_iris`. |
73
+ | `5` | **Gaussian NaΓ―ve Bayes** | **Yes** | Path: `E:/sriram intern/datasot_5.csv`<br>Format: CSV with header. Column 0 ignored. Numeric feature columns in `iloc[:, 1:-1]`, binary target in `iloc[:, -1]`. |
74
+ | `6` | **Text Classification / Spam** | **Yes** | Path: `E:\sriram intern\downloadsss\prg6new.csv`<br>Format: CSV with header columns `text` (message string) and `label` (categories including `'spam'` and `'ham'`). |
75
+ | `7` | **t-test & One-Way ANOVA** | No | Uses built-in `seaborn.load_dataset('iris')`. |
76
+ | `8` | **Backpropagation Network** | No | Uses built-in `sklearn.datasets.load_iris`. |
77
+ | `9` | **k-Nearest Neighbors (k-NN)** | No | Uses built-in `sklearn.datasets.load_iris`. |
78
+ | `10` | **Simple Linear Regression** | No | Uses built-in `sklearn.datasets.load_diabetes`. |
79
+
80
+ ---
81
+
82
+ ## πŸ›‘οΈ Error Handling
83
+
84
+ Passing an invalid programme number (outside the range 1 to 10) raises a clear `ValueError`:
85
+
86
+ ```python
87
+ skklearn.show_code(15)
88
+ # ValueError: Invalid programme number '15'. Please choose a number from 1 to 10.
89
+ ```
90
+
91
+ ---
92
+
93
+ ## πŸ“¦ Dependencies
94
+
95
+ The package declares the third-party libraries needed when you run the copied syllabus programmes:
96
+ - `pandas`
97
+ - `numpy`
98
+ - `scikit-learn`
99
+ - `matplotlib`
100
+ - `seaborn`
101
+ - `scipy`
102
+ - `statsmodels`
@@ -0,0 +1,35 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "skklearn-lab-tools"
7
+ version = "0.1.0"
8
+ description = "An educational collection of ten Python machine learning and data analysis programmes."
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = "MIT"
12
+ authors = [
13
+ { name = "Sriram" }
14
+ ]
15
+ keywords = ["machine-learning", "education", "syllabus", "data-analysis", "skklearn"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Education",
19
+ "Programming Language :: Python :: 3",
20
+ "Topic :: Education",
21
+ "Topic :: Scientific/Engineering :: Artificial Intelligence"
22
+ ]
23
+ dependencies = [
24
+ "pandas",
25
+ "numpy",
26
+ "scikit-learn",
27
+ "matplotlib",
28
+ "seaborn",
29
+ "scipy",
30
+ "statsmodels"
31
+ ]
32
+
33
+ [tool.setuptools.packages.find]
34
+ where = ["src"]
35
+
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,45 @@
1
+ """
2
+ skklearn - Educational source-code library of ten Python machine learning and data analysis syllabus programmes.
3
+ """
4
+
5
+ from pathlib import Path
6
+
7
+ __version__ = "0.1.0"
8
+
9
+ _PROGRAMME_MAP = {
10
+ 1: "prog1.py",
11
+ 2: "prog2.py",
12
+ 3: "prog3.py",
13
+ 4: "prog4.py",
14
+ 5: "prog5.py",
15
+ 6: "prog6.py",
16
+ 7: "prog7.py",
17
+ 8: "prog8.py",
18
+ 9: "prog9.py",
19
+ 10: "prog10.py",
20
+ }
21
+
22
+ def show_code(program_number):
23
+ """
24
+ Displays the exact plain text source code of the specified syllabus programme (1-10)
25
+ in the console or IDLE Shell for copying. Does not execute or import the programme.
26
+ """
27
+ try:
28
+ num = int(program_number)
29
+ if num not in _PROGRAMME_MAP:
30
+ raise ValueError
31
+ except (ValueError, TypeError):
32
+ raise ValueError(
33
+ f"Invalid programme number '{program_number}'. Please choose a number from 1 to 10."
34
+ )
35
+
36
+ target_file = Path(__file__).resolve().parent / _PROGRAMME_MAP[num]
37
+ if not target_file.is_file():
38
+ raise FileNotFoundError(
39
+ f"Source file for programme {num} was not found at {target_file}"
40
+ )
41
+
42
+ content = target_file.read_text(encoding="utf-8")
43
+ print(content)
44
+
45
+ __all__ = ["show_code"]
@@ -0,0 +1,18 @@
1
+ import pandas as pd
2
+ data=pd.read_csv("E:/sriram intern/sampledataset.csv")
3
+ print("Training Data:/n")
4
+ print(data)
5
+ con=data.iloc[:,:-1].values
6
+ tar=data.iloc[:,-1].values
7
+ for i in range (len(tar)):
8
+ if tar[i].lower()=="yes":
9
+ hypothesis=con[i].copy()
10
+ print("hi")
11
+ break
12
+ for i in range(len(con)):
13
+ if tar[i].lower()=="yes":
14
+ for j in range(len(hypothesis)):
15
+ if hypothesis[j]!=con[i][j]:
16
+ hypothesis[j]='?'
17
+ print("\n Most Specific Hypothesis:")
18
+ print(hypothesis)
@@ -0,0 +1,27 @@
1
+ import matplotlib.pyplot as plt
2
+ from sklearn.datasets import load_diabetes
3
+ from sklearn.linear_model import LinearRegression
4
+ from sklearn.model_selection import train_test_split
5
+ from sklearn.metrics import mean_squared_error
6
+
7
+ d=load_diabetes();
8
+ X=d.data[:,2:3];
9
+ y=d.target
10
+ X1,X2,y1,y2=train_test_split(X,y,test_size=0.2,random_state=42)
11
+
12
+ m=LinearRegression().fit(X1,y1);
13
+ p=m.predict(X2)
14
+
15
+ print("MSE:",mean_squared_error(y2,p))
16
+ print("Intercept:",m.intercept_)
17
+ print("Coefficient:",m.coef_[0])
18
+
19
+ plt.scatter(X2,y2);
20
+ plt.plot(X2,p,color="red")
21
+ plt.xlabel("BMI feature");
22
+ plt.ylabel("Disease Progression")
23
+ plt.title("Linear Regression on diabetes dataset");
24
+ plt.show()
25
+
26
+ for b in [.05,.10,-.02]:
27
+ print("BMI",b,":",m.predict([[b]])[0])
@@ -0,0 +1,19 @@
1
+ import pandas as pd
2
+ data=pd.read_csv("E:/sriram intern/sampledataset.csv")
3
+ con=data.iloc[:,:-1].values
4
+ tar=data.iloc[:,-1].values
5
+ S=con[0].copy()
6
+ G=["?"]*len(con)
7
+ for i in range(len(con)):
8
+ if tar[i]=="yes":
9
+ for j in range(len(S)):
10
+ if S[j]!=con[i][j]:
11
+ S[j]="?"
12
+ else:
13
+ for j in range(len(S)):
14
+ if S[j]!=con[i][j]:
15
+ G[j]=S[j]
16
+ print("S:")
17
+ print(S)
18
+ print("G:")
19
+ print(G)
@@ -0,0 +1,18 @@
1
+ from sklearn.datasets import load_iris
2
+ from sklearn.model_selection import train_test_split
3
+ from sklearn.tree import DecisionTreeClassifier
4
+ from sklearn.metrics import accuracy_score
5
+ iris = load_iris()
6
+ X = iris.data
7
+ y = iris.target
8
+ X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2,random_state=42)
9
+ clf = DecisionTreeClassifier()
10
+ clf.fit(X_train, y_train)
11
+ y_pred = clf.predict(X_test)
12
+ accuracy = accuracy_score(y_test,y_pred)
13
+ print("Accuracy =",accuracy)
14
+ new_sample = [[5.1, 2.5, 4.6,1.5]]
15
+ prediction =clf.predict(new_sample)
16
+ print("Predicted Class =",iris.target_names[prediction[0]])
17
+ print("finised")
18
+
@@ -0,0 +1,18 @@
1
+ from sklearn.datasets import load_iris
2
+ from sklearn.model_selection import train_test_split
3
+ from sklearn.preprocessing import StandardScaler
4
+ from sklearn.neural_network import MLPClassifier
5
+ from sklearn.metrics import accuracy_score,classification_report
6
+ iris=load_iris()
7
+ X=iris.data
8
+ y=iris.target
9
+ X_train,X_test,y_train,y_test=train_test_split(X,y,test_size=0.2,random_state=42)
10
+ scaler=StandardScaler()
11
+ X_train=scaler.fit_transform(X_train)
12
+ X_test=scaler.transform(X_test)
13
+ model=MLPClassifier(hidden_layer_sizes=(10,),activation='relu',max_iter=1000,random_state=1)
14
+ model.fit(X_train,y_train)
15
+ y_pred=model.predict(X_test)
16
+ print("Accuracy:",accuracy_score(y_test,y_pred))
17
+ print("\nClassification Report:")
18
+ print(classification_report(y_test,y_pred,target_names=iris.target_names))
@@ -0,0 +1,19 @@
1
+ import pandas as pd
2
+ from sklearn.naive_bayes import GaussianNB
3
+ from sklearn.model_selection import train_test_split
4
+ from sklearn.metrics import accuracy_score,precision_score,recall_score
5
+ data=pd.read_csv("E:/sriram intern/datasot_5.csv")
6
+ print(data)
7
+ x=data.iloc[:,1:-1]
8
+ y=data.iloc[:,-1]
9
+ print("\nTraining Data:\n")
10
+ print(x)
11
+ print("\nTarget:\n")
12
+ print(y)
13
+ x_train,x_test,y_train,y_test=train_test_split(x,y,test_size=0.20,random_state=0)
14
+ classifier=GaussianNB()
15
+ classifier.fit(x_train,y_train)
16
+ y_pred=classifier.predict(x_test)
17
+ print("\nAccuracy:",accuracy_score(y_test,y_pred))
18
+ print("\nRecall:",recall_score(y_test,y_pred))
19
+ print("\nPrecision:",precision_score(y_test,y_pred))
@@ -0,0 +1,15 @@
1
+ import pandas as pd
2
+ from sklearn.model_selection import train_test_split
3
+ from sklearn.feature_extraction.text import CountVectorizer
4
+ from sklearn.naive_bayes import MultinomialNB
5
+ from sklearn.metrics import accuracy_score,precision_score,recall_score
6
+
7
+ df=pd.read_csv("E:\sriram intern\downloadsss\prg6new.csv")
8
+ X=CountVectorizer().fit_transform(df.text)
9
+ y=df.label
10
+ a,b,c,d=train_test_split(X,y,test_size=.2,random_state=0)
11
+ p=MultinomialNB().fit(a,c).predict(b)
12
+
13
+ print(accuracy_score(d,p))
14
+ print(precision_score(d,p,pos_label="spam"))
15
+ print(recall_score(d,p,pos_label="spam"))
@@ -0,0 +1,19 @@
1
+ import seaborn as sns
2
+ from scipy import stats
3
+ from statsmodels.formula.api import ols
4
+ import statsmodels.api as sm
5
+
6
+ d=sns.load_dataset('iris')
7
+
8
+ a=d[d.species=='setosa'].petal_length
9
+ b=d[d.species=='versicolor'].petal_length
10
+ t,p=stats.ttest_ind(a,b)
11
+
12
+ print("Independent samples t-test results:")
13
+ print("t-statistics:",t)
14
+ print("p_value:",p)
15
+ print("Reject null hypothesis" if p<0.05 else "Accept null hypothesis")
16
+
17
+ m=ols('sepal_length ~ C(species)',data=d).fit()
18
+ print("\nOne-Way ANOVA Results:")
19
+ print(sm.stats.anova_lm(m,typ=2))
@@ -0,0 +1,32 @@
1
+ import numpy as np
2
+ import matplotlib.pyplot as plt
3
+ from sklearn.datasets import load_iris
4
+ from sklearn.model_selection import train_test_split
5
+
6
+ np.random.seed(10)
7
+ d=load_iris();
8
+ X=d.data;
9
+ y=np.eye(3)[d.target]
10
+ X1,X2,y1,y2=train_test_split(X,y,test_size=.2,random_state=4)
11
+
12
+ W1=np.random.randn(4,2)*.5;
13
+ W2=np.random.randn(2,3)*.5
14
+ sig=lambda x:1/(1+np.exp(-x));
15
+ acc=[]
16
+
17
+ for i in range(5000):
18
+ h=sig(X1@W1);
19
+ o=sig(h@W2)
20
+ acc.append(np.mean(o.argmax(1)==y1.argmax(1)))
21
+ e=o-y1;
22
+ oe=e*o*(1-o);
23
+ he=(oe@W2.T)*h*(1-h)
24
+ W2-=.1*h.T@oe;
25
+ W1-=.1*X1.T@he
26
+
27
+ print("Accuracy:",acc[-1]*100,"%")
28
+ plt.plot(acc)
29
+ plt.xlabel("Iterations");
30
+ plt.ylabel("Accuracy")
31
+ plt.title("Accuracy")
32
+ plt.show()
@@ -0,0 +1,19 @@
1
+ from sklearn import datasets,metrics
2
+ from sklearn.model_selection import train_test_split
3
+ from sklearn.neighbors import KNeighborsClassifier
4
+ from sklearn.metrics import classification_report
5
+
6
+ iris=datasets.load_iris()
7
+ X_train,X_test,y_train,y_test=train_test_split(
8
+ iris.data,iris.target,random_state=0)
9
+
10
+ model=KNeighborsClassifier(n_neighbors=2)
11
+ model.fit(X_train,y_train)
12
+ pred=model.predict(X_test)
13
+
14
+ for i in range(len(pred)):
15
+ print("Actual:",y_test[i],"Predicted:",pred[i])
16
+
17
+ print("Accuracy:",model.score(X_test,y_test))
18
+ print("Confusion Matrix:\n",metrics.confusion_matrix(y_test,pred))
19
+ print("Classification Report:\n",classification_report(y_test,pred))
@@ -0,0 +1,126 @@
1
+ Metadata-Version: 2.4
2
+ Name: skklearn-lab-tools
3
+ Version: 0.1.0
4
+ Summary: An educational collection of ten Python machine learning and data analysis programmes.
5
+ Author: Sriram
6
+ License-Expression: MIT
7
+ Keywords: machine-learning,education,syllabus,data-analysis,skklearn
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Intended Audience :: Education
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Topic :: Education
12
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: pandas
17
+ Requires-Dist: numpy
18
+ Requires-Dist: scikit-learn
19
+ Requires-Dist: matplotlib
20
+ Requires-Dist: seaborn
21
+ Requires-Dist: scipy
22
+ Requires-Dist: statsmodels
23
+ Dynamic: license-file
24
+
25
+ # skklearn
26
+
27
+ An educational source-code library of ten Python machine learning and data analysis syllabus programmes.
28
+
29
+ > **Disclaimer:** `skklearn` is an independent educational package and is **not affiliated with or endorsed by scikit-learn**.
30
+
31
+ ---
32
+
33
+ ## 🎯 Purpose
34
+
35
+ `skklearn` allows students and lab instructors to install the package, view the exact original source code of any syllabus programme directly in Python IDLE or the terminal, and copy it into a new `.py` file to work with in the lab.
36
+
37
+ **Key Design Principles:**
38
+ - **Source Code Library**: Designed to display and copy unmodified source code, not automatically execute it.
39
+ - **Zero Bundled Datasets**: No CSV files or datasets are included in the package.
40
+ - **Exact Code Preservation**: All 10 original programmes are preserved byte-for-byte with their original variable names, logic, and file paths.
41
+
42
+ ---
43
+
44
+ ## πŸ’» Installation
45
+
46
+ Install `skklearn` using `pip`:
47
+
48
+ ```bash
49
+ py -m pip install skklearn
50
+ ```
51
+
52
+ Or install locally from the built wheel:
53
+
54
+ ```bash
55
+ py -m pip install dist/skklearn-0.1.0-py3-none-any.whl
56
+ ```
57
+
58
+ ---
59
+
60
+ ## πŸš€ How to Use in the College Lab / Python IDLE
61
+
62
+ ### Step 1: Open Python IDLE or Interactive Shell
63
+
64
+ Import `skklearn` and call `show_code(program_number)`:
65
+
66
+ ```python
67
+ import skklearn
68
+
69
+ # Display Programme 1 (Find-S Algorithm)
70
+ skklearn.show_code(1)
71
+ ```
72
+
73
+ The exact source code will print directly in your IDLE Shell.
74
+
75
+ ### Step 2: Copy Code into a New File
76
+ 1. In Python IDLE, highlight and copy the printed code.
77
+ 2. Select **File > New File** (`Ctrl + N`).
78
+ 3. Paste the code into your new editor window.
79
+ 4. Save the file (e.g., `lab_prog1.py`).
80
+
81
+ ### Step 3: Set Up Required Datasets (If Applicable)
82
+ For programmes that use external CSV files, create the dataset at the path hardcoded in the original syllabus programme (see table below).
83
+
84
+ ### Step 4: Run the Programme
85
+ Press **F5** (or **Run > Run Module**) in IDLE to execute your script.
86
+
87
+ ---
88
+
89
+ ## πŸ“‹ Syllabus Programmes & Dataset Requirements
90
+
91
+ | Programme Number | Algorithm / Title | External CSV Required? | Expected Path & Format |
92
+ | :---: | :--- | :---: | :--- |
93
+ | `1` | **Find-S Algorithm** | **Yes** | Path: `E:/sriram intern/sampledataset.csv`<br>Format: CSV with header. Categorical string attributes in `iloc[:, :-1]`, target concept in `iloc[:, -1]` with `'yes'`/`'no'`. |
94
+ | `2` | **Candidate Elimination** | **Yes** | Path: `E:/sriram intern/sampledataset.csv`<br>Format: Shared with Programme 1. |
95
+ | `3` | **Decision Tree Classifier** | No | Uses built-in `sklearn.datasets.load_iris`. |
96
+ | `4` | **Multi-Layer Perceptron (MLP)** | No | Uses built-in `sklearn.datasets.load_iris`. |
97
+ | `5` | **Gaussian NaΓ―ve Bayes** | **Yes** | Path: `E:/sriram intern/datasot_5.csv`<br>Format: CSV with header. Column 0 ignored. Numeric feature columns in `iloc[:, 1:-1]`, binary target in `iloc[:, -1]`. |
98
+ | `6` | **Text Classification / Spam** | **Yes** | Path: `E:\sriram intern\downloadsss\prg6new.csv`<br>Format: CSV with header columns `text` (message string) and `label` (categories including `'spam'` and `'ham'`). |
99
+ | `7` | **t-test & One-Way ANOVA** | No | Uses built-in `seaborn.load_dataset('iris')`. |
100
+ | `8` | **Backpropagation Network** | No | Uses built-in `sklearn.datasets.load_iris`. |
101
+ | `9` | **k-Nearest Neighbors (k-NN)** | No | Uses built-in `sklearn.datasets.load_iris`. |
102
+ | `10` | **Simple Linear Regression** | No | Uses built-in `sklearn.datasets.load_diabetes`. |
103
+
104
+ ---
105
+
106
+ ## πŸ›‘οΈ Error Handling
107
+
108
+ Passing an invalid programme number (outside the range 1 to 10) raises a clear `ValueError`:
109
+
110
+ ```python
111
+ skklearn.show_code(15)
112
+ # ValueError: Invalid programme number '15'. Please choose a number from 1 to 10.
113
+ ```
114
+
115
+ ---
116
+
117
+ ## πŸ“¦ Dependencies
118
+
119
+ The package declares the third-party libraries needed when you run the copied syllabus programmes:
120
+ - `pandas`
121
+ - `numpy`
122
+ - `scikit-learn`
123
+ - `matplotlib`
124
+ - `seaborn`
125
+ - `scipy`
126
+ - `statsmodels`
@@ -0,0 +1,19 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ src/skklearn/__init__.py
5
+ src/skklearn/prog1.py
6
+ src/skklearn/prog10.py
7
+ src/skklearn/prog2.py
8
+ src/skklearn/prog3.py
9
+ src/skklearn/prog4.py
10
+ src/skklearn/prog5.py
11
+ src/skklearn/prog6.py
12
+ src/skklearn/prog7.py
13
+ src/skklearn/prog8.py
14
+ src/skklearn/prog9.py
15
+ src/skklearn_lab_tools.egg-info/PKG-INFO
16
+ src/skklearn_lab_tools.egg-info/SOURCES.txt
17
+ src/skklearn_lab_tools.egg-info/dependency_links.txt
18
+ src/skklearn_lab_tools.egg-info/requires.txt
19
+ src/skklearn_lab_tools.egg-info/top_level.txt
@@ -0,0 +1,7 @@
1
+ pandas
2
+ numpy
3
+ scikit-learn
4
+ matplotlib
5
+ seaborn
6
+ scipy
7
+ statsmodels