pico-lab 0.1.0__py3-none-any.whl

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.
pico_lab/__init__.py ADDED
@@ -0,0 +1,2 @@
1
+
2
+ __version__ = "0.1.0"
pico_lab/bfs.py ADDED
@@ -0,0 +1,38 @@
1
+
2
+ from collections import deque
3
+
4
+
5
+ def bfs(graph, start):
6
+ visited = set()
7
+ queue = deque([start])
8
+
9
+ while queue:
10
+ node = queue.popleft()
11
+
12
+ if node not in visited:
13
+ visited.add(node)
14
+ print(node)
15
+
16
+ queue.extend([
17
+ neighbor
18
+ for neighbor in graph[node]
19
+ if neighbor not in visited
20
+ ])
21
+
22
+
23
+ def run():
24
+ graph = {
25
+ "A": ["B", "C"],
26
+ "B": ["D", "E"],
27
+ "C": ["F"],
28
+ "D": [],
29
+ "E": ["F"],
30
+ "F": []
31
+ }
32
+
33
+ print("Breadth First Search:")
34
+ bfs(graph, "A")
35
+
36
+
37
+ if __name__ == "__main__":
38
+ run()
pico_lab/cli.py ADDED
@@ -0,0 +1,64 @@
1
+
2
+ from pathlib import Path
3
+
4
+ EXPERIMENTS = {
5
+ "1": "eda.py",
6
+ "2": "preprocessing.py",
7
+ "3": "linear_regression.py",
8
+ "4": "single_perceptron.py",
9
+ "5": "mlp.py",
10
+ "6": "knn.py",
11
+ "7": "svr.py",
12
+ "8": "fuzzy_sets.py",
13
+ "9": "naive_bayes.py",
14
+ "10": "kmeans.py",
15
+ "11": "dfs.py",
16
+ "12": "bfs.py",
17
+ }
18
+
19
+ NAMES = {
20
+ "1": "Exploratory Data Analysis",
21
+ "2": "Data Pre-processing",
22
+ "3": "Linear Regression Models",
23
+ "4": "Single Layer Perceptron",
24
+ "5": "Multiple Layer Perceptron",
25
+ "6": "KNN Classifier",
26
+ "7": "Support Vector Regression",
27
+ "8": "Primitive Operations on Fuzzy Sets",
28
+ "9": "Naive Bayes Classifier",
29
+ "10": "K-Means Clustering",
30
+ "11": "Depth First Search",
31
+ "12": "Breadth First Search",
32
+ }
33
+
34
+
35
+ def main():
36
+ print("\n======================================")
37
+ print(" PICO LAB")
38
+ print(" AI AND ML LABORATORY TOOLKIT")
39
+ print("======================================")
40
+
41
+ for number, name in NAMES.items():
42
+ print(f"{number}. {name}")
43
+
44
+ choice = input("\nEnter experiment number: ").strip()
45
+
46
+ if choice not in EXPERIMENTS:
47
+ print("Invalid experiment number!")
48
+ return
49
+
50
+ file_path = Path(__file__).parent / EXPERIMENTS[choice]
51
+
52
+ print("\n======================================")
53
+ print(f" EXPERIMENT {choice}: {NAMES[choice]}")
54
+ print("======================================\n")
55
+
56
+ try:
57
+ code = file_path.read_text(encoding="utf-8")
58
+ print(code)
59
+ except FileNotFoundError:
60
+ print("Experiment file not found!")
61
+
62
+
63
+ if __name__ == "__main__":
64
+ main()
pico_lab/dfs.py ADDED
@@ -0,0 +1,35 @@
1
+
2
+ def dfs(graph, start):
3
+ visited = set()
4
+ stack = [start]
5
+
6
+ while stack:
7
+ node = stack.pop()
8
+
9
+ if node not in visited:
10
+ visited.add(node)
11
+ print(node)
12
+
13
+ stack.extend([
14
+ neighbor
15
+ for neighbor in graph[node]
16
+ if neighbor not in visited
17
+ ])
18
+
19
+
20
+ def run():
21
+ graph = {
22
+ "A": ["B", "C"],
23
+ "B": ["D", "E"],
24
+ "C": ["F"],
25
+ "D": [],
26
+ "E": ["F"],
27
+ "F": []
28
+ }
29
+
30
+ print("Depth First Search:")
31
+ dfs(graph, "A")
32
+
33
+
34
+ if __name__ == "__main__":
35
+ run()
pico_lab/eda.py ADDED
@@ -0,0 +1,114 @@
1
+
2
+ import pandas as pd
3
+ import numpy as np
4
+ import seaborn as sns
5
+ import matplotlib.pyplot as plt
6
+ import warnings
7
+
8
+ warnings.filterwarnings("ignore")
9
+
10
+
11
+ def run():
12
+ # Load dataset
13
+ df = pd.read_csv("Toyota.csv")
14
+
15
+ # Display dataset
16
+ print("First 5 rows:")
17
+ print(df.head(5))
18
+
19
+ print("\nLast 5 rows:")
20
+ print(df.tail(5))
21
+
22
+ print("\nDataset shape:")
23
+ print(df.shape)
24
+
25
+ # Select numerical columns
26
+ print("\nNumerical columns:")
27
+ print(df.select_dtypes(exclude=["object"]).columns.tolist())
28
+
29
+ mi = df.select_dtypes(exclude=["object"])
30
+
31
+ print("\nMinimum values:")
32
+ print(mi.min())
33
+
34
+ print("\nMaximum values:")
35
+ print(mi.max())
36
+
37
+ print("\nMode:")
38
+ print(mi.mode())
39
+
40
+ # Check missing values
41
+ print("\nMissing values:")
42
+ print(df.isnull())
43
+
44
+ # Box plot
45
+ df.boxplot(figsize=(5, 5), rot=90, fontsize=8, grid=False)
46
+ plt.title("Box Plot")
47
+ plt.show()
48
+
49
+ # Z-score analysis for KM
50
+ mean = np.mean(df["KM"])
51
+ std = np.std(df["KM"])
52
+
53
+ print("\nKM Z-score:")
54
+ print((df["KM"] - mean) / std)
55
+
56
+ df["KM-z_score"] = (df["KM"] - mean) / std
57
+ print(df.head(5))
58
+
59
+ # Correlation
60
+ print("\nCorrelation:")
61
+ print(df.corr(numeric_only=True))
62
+
63
+ # Distribution plot
64
+ sns.displot(data=df, x="HP", kde=True, fill=True)
65
+ plt.show()
66
+
67
+ # Bar plot
68
+ df["Automatic"].value_counts().plot(kind="bar")
69
+ plt.show()
70
+
71
+ # Swarm plot and violin plot
72
+ plt.figure(figsize=(10, 5))
73
+
74
+ plt.subplot(1, 2, 1)
75
+ sns.swarmplot(x=df["Price"])
76
+
77
+ plt.subplot(1, 2, 2)
78
+ sns.violinplot(x=df["Price"])
79
+
80
+ plt.show()
81
+
82
+ # Scatter plot
83
+ df.plot("Price", "HP", kind="scatter")
84
+ plt.show()
85
+
86
+ # Bar plot
87
+ plt.figure(figsize=(15, 10))
88
+ sns.barplot(
89
+ x="Price",
90
+ y="HP",
91
+ data=df[15:35],
92
+ palette="plasma"
93
+ )
94
+ plt.show()
95
+
96
+ # Count plot
97
+ sns.countplot(x=df["Weight"])
98
+ plt.show()
99
+
100
+ # Pair plot
101
+ sns.pairplot(df)
102
+ plt.show()
103
+
104
+ # Automatic value counts
105
+ counts = df["Automatic"].value_counts()
106
+
107
+ plt.bar(counts.index, counts.values)
108
+ plt.xlabel("Automatic")
109
+ plt.ylabel("Counts")
110
+ plt.show()
111
+
112
+
113
+ if __name__ == "__main__":
114
+ run()
pico_lab/fuzzy_sets.py ADDED
@@ -0,0 +1,73 @@
1
+
2
+ def run():
3
+ # Union of two fuzzy sets
4
+ A = {"a": 0.2, "b": 0.3, "c": 0.6, "d": 0.6}
5
+ B = {"a": 0.9, "b": 0.6, "c": 0.4, "d": 0.5}
6
+ Y = {}
7
+
8
+ print("The first fuzzy set is:", A)
9
+ print("The second fuzzy set is:", B)
10
+
11
+ for key in A:
12
+ A_value = A[key]
13
+ B_value = B.get(key, 0)
14
+ Y[key] = max(A_value, B_value)
15
+
16
+ print("Fuzzy set union is:", Y)
17
+
18
+ # Intersection of two fuzzy sets
19
+ Y = {}
20
+
21
+ for key in A:
22
+ A_value = A[key]
23
+ B_value = B.get(key, 0)
24
+ Y[key] = min(A_value, B_value)
25
+
26
+ print("Fuzzy set intersection is:", Y)
27
+
28
+ # Complement of fuzzy set
29
+ Y = {}
30
+
31
+ print("The fuzzy set is:", A)
32
+
33
+ for key in A:
34
+ Y[key] = 1 - A[key]
35
+
36
+ print("Fuzzy set complement is:", Y)
37
+
38
+ # Scalar multiplication of fuzzy set
39
+ alpha = 0.5
40
+ Y = {}
41
+
42
+ print("Scalar multiplication by", alpha)
43
+
44
+ for key in A:
45
+ Y[key] = min(1, alpha * A[key])
46
+
47
+ print("Result of scalar multiplication is:", Y)
48
+
49
+ # Fuzzy addition of two fuzzy sets
50
+ Y = {}
51
+
52
+ for key in set(A) | set(B):
53
+ A_value = A.get(key, 0)
54
+ B_value = B.get(key, 0)
55
+ Y[key] = min(1, A_value + B_value)
56
+
57
+ print("Fuzzy addition of A and B is:", Y)
58
+
59
+ # Fuzzy subtraction of two fuzzy sets
60
+ A = {"a": 0.9, "b": 0.6, "c": 0.4, "d": 0.5}
61
+ B = {"a": 0.2, "b": 0.3, "c": 0.6, "d": 0.6}
62
+ Y = {}
63
+
64
+ for key in set(A) | set(B):
65
+ A_value = A.get(key, 0)
66
+ B_value = B.get(key, 0)
67
+ Y[key] = max(0, A_value - B_value)
68
+
69
+ print("Fuzzy subtraction of A and B is:", Y)
70
+
71
+
72
+ if __name__ == "__main__":
73
+ run()
pico_lab/kmeans.py ADDED
@@ -0,0 +1,57 @@
1
+
2
+ import numpy as np
3
+ import pandas as pd
4
+ import matplotlib.pyplot as plt
5
+
6
+ from sklearn import datasets
7
+ from sklearn.cluster import KMeans
8
+
9
+
10
+ def run():
11
+ # Load Iris dataset
12
+ iris = datasets.load_iris()
13
+ X = iris.data
14
+ y = iris.target
15
+
16
+ # Create a DataFrame
17
+ df = pd.DataFrame(X, columns=iris.feature_names)
18
+
19
+ print("Dataset preview:")
20
+ print(df.head())
21
+
22
+ # Apply KMeans clustering
23
+ k = 3
24
+ kmeans = KMeans(n_clusters=k, random_state=42, n_init=10)
25
+ kmeans.fit(X)
26
+
27
+ # Add predicted cluster labels
28
+ df["Cluster"] = kmeans.labels_
29
+
30
+ print("\nCluster centers:\n", kmeans.cluster_centers_)
31
+ print("\nFirst 10 cluster labels:\n", df["Cluster"].head(10))
32
+
33
+ # Visualize clusters using first two features
34
+ plt.scatter(
35
+ X[:, 0], X[:, 1],
36
+ c=kmeans.labels_,
37
+ cmap="rainbow"
38
+ )
39
+
40
+ plt.scatter(
41
+ kmeans.cluster_centers_[:, 0],
42
+ kmeans.cluster_centers_[:, 1],
43
+ color="black",
44
+ marker="X",
45
+ s=200,
46
+ label="Centroids"
47
+ )
48
+
49
+ plt.title("K-Means Clustering (Iris Dataset)")
50
+ plt.xlabel("Sepal Length (cm)")
51
+ plt.ylabel("Sepal Width (cm)")
52
+ plt.legend()
53
+ plt.show()
54
+
55
+
56
+ if __name__ == "__main__":
57
+ run()
pico_lab/knn.py ADDED
@@ -0,0 +1,45 @@
1
+
2
+ import pandas as pd
3
+
4
+ from sklearn import datasets
5
+ from sklearn.model_selection import train_test_split
6
+ from sklearn.neighbors import KNeighborsClassifier
7
+ from sklearn.metrics import accuracy_score
8
+
9
+
10
+ def run():
11
+ # Load Iris dataset
12
+ iris = datasets.load_iris()
13
+ X = iris.data
14
+ y = iris.target
15
+
16
+ # Convert to pandas DataFrame
17
+ df = pd.DataFrame(X, columns=iris.feature_names)
18
+ df["target"] = y
19
+
20
+ # Describe the dataset
21
+ print("Dataset summary (using pandas describe):")
22
+ print(df.describe(include="all"))
23
+
24
+ # Split dataset into training and testing sets
25
+ X_train, X_test, y_train, y_test = train_test_split(
26
+ X, y, test_size=0.3, random_state=24
27
+ )
28
+
29
+ # Create KNN classifier
30
+ k = 3
31
+ knn_classifier = KNeighborsClassifier(n_neighbors=k)
32
+
33
+ # Fit classifier to training data
34
+ knn_classifier.fit(X_train, y_train)
35
+
36
+ # Make predictions
37
+ y_pred = knn_classifier.predict(X_test)
38
+
39
+ # Calculate accuracy
40
+ accuracy = accuracy_score(y_test, y_pred)
41
+ print(f"\nAccuracy: {accuracy * 100:.2f}%")
42
+
43
+
44
+ if __name__ == "__main__":
45
+ run()
@@ -0,0 +1,66 @@
1
+
2
+ import numpy as np
3
+ import pandas as pd
4
+ import matplotlib.pyplot as plt
5
+
6
+ from sklearn.model_selection import train_test_split
7
+ from sklearn.linear_model import LinearRegression
8
+ from sklearn.metrics import mean_squared_error, r2_score
9
+
10
+
11
+ def run():
12
+ # Dataset: Years of experience and salary
13
+ data = {
14
+ "Experience": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
15
+ "Salary": [
16
+ 45000, 50000, 60000, 65000, 70000,
17
+ 75000, 80000, 85000, 90000, 95000
18
+ ]
19
+ }
20
+
21
+ df = pd.DataFrame(data)
22
+ print("Dataset:")
23
+ print(df)
24
+
25
+ # Independent and dependent variables
26
+ X = df[["Experience"]]
27
+ y = df["Salary"]
28
+
29
+ # Split dataset: 80% training, 20% testing
30
+ X_train, X_test, y_train, y_test = train_test_split(
31
+ X, y, test_size=0.2, random_state=42
32
+ )
33
+
34
+ # Create and train the model
35
+ model = LinearRegression()
36
+ model.fit(X_train, y_train)
37
+
38
+ # Predict test data
39
+ y_pred = model.predict(X_test)
40
+
41
+ # Model parameters
42
+ print("\nIntercept (b0):", model.intercept_)
43
+ print("Coefficient (b1):", model.coef_[0])
44
+
45
+ # Evaluate model
46
+ print("Mean Squared Error (MSE):",
47
+ mean_squared_error(y_test, y_pred))
48
+ print("R2 Score:", r2_score(y_test, y_pred))
49
+
50
+ # Plot results
51
+ plt.scatter(X, y, color="blue", label="Actual Data")
52
+ plt.plot(
53
+ X, model.predict(X),
54
+ color="red", linewidth=2,
55
+ label="Regression Line"
56
+ )
57
+
58
+ plt.xlabel("Years of Experience")
59
+ plt.ylabel("Salary")
60
+ plt.title("Linear Regression Example")
61
+ plt.legend()
62
+ plt.show()
63
+
64
+
65
+ if __name__ == "__main__":
66
+ run()
pico_lab/mlp.py ADDED
@@ -0,0 +1,38 @@
1
+
2
+ from sklearn.datasets import load_iris
3
+ from sklearn.model_selection import train_test_split
4
+ from sklearn.neural_network import MLPClassifier
5
+ from sklearn.metrics import accuracy_score
6
+
7
+
8
+ def run():
9
+ # 1. Load Iris dataset
10
+ iris = load_iris()
11
+ X, y = iris.data, iris.target
12
+
13
+ # 2. Split data into training and testing sets
14
+ X_train, X_test, y_train, y_test = train_test_split(
15
+ X, y, test_size=0.3, random_state=42
16
+ )
17
+
18
+ # 3. Initialize MLPClassifier
19
+ mlp = MLPClassifier(
20
+ hidden_layer_sizes=(10),
21
+ activation="relu",
22
+ max_iter=1000,
23
+ random_state=42
24
+ )
25
+
26
+ # 4. Train the MLP model
27
+ mlp.fit(X_train, y_train)
28
+
29
+ # 5. Make predictions on test set
30
+ y_pred = mlp.predict(X_test)
31
+
32
+ # 6. Evaluate model accuracy
33
+ accuracy = accuracy_score(y_test, y_pred)
34
+ print(f"MLP Classifier Accuracy: {accuracy:.4f}")
35
+
36
+
37
+ if __name__ == "__main__":
38
+ run()
@@ -0,0 +1,53 @@
1
+
2
+ from sklearn import datasets
3
+ from sklearn.model_selection import train_test_split
4
+ from sklearn.naive_bayes import GaussianNB
5
+ from sklearn.metrics import (
6
+ accuracy_score,
7
+ classification_report,
8
+ confusion_matrix
9
+ )
10
+
11
+
12
+ def run():
13
+ # Load Iris dataset
14
+ iris = datasets.load_iris()
15
+ X = iris.data
16
+ y = iris.target
17
+
18
+ # Split the dataset
19
+ X_train, X_test, y_train, y_test = train_test_split(
20
+ X, y, test_size=0.2, random_state=42
21
+ )
22
+
23
+ # Create Naive Bayes classifier
24
+ clf = GaussianNB()
25
+
26
+ # Train the classifier
27
+ clf.fit(X_train, y_train)
28
+
29
+ # Make predictions
30
+ y_pred = clf.predict(X_test)
31
+
32
+ # Evaluate the classifier
33
+ accuracy = accuracy_score(y_test, y_pred)
34
+ confusion = confusion_matrix(y_test, y_pred)
35
+
36
+ classification_rep = classification_report(
37
+ y_test,
38
+ y_pred,
39
+ target_names=iris.target_names
40
+ )
41
+
42
+ # Print results
43
+ print("Accuracy:", accuracy)
44
+
45
+ print("\nConfusion matrix:")
46
+ print(confusion)
47
+
48
+ print("\nClassification report:")
49
+ print(classification_rep)
50
+
51
+
52
+ if __name__ == "__main__":
53
+ run()
@@ -0,0 +1,99 @@
1
+
2
+ import pandas as pd
3
+ import numpy as np
4
+ import matplotlib.pyplot as plt
5
+ import seaborn as sns
6
+
7
+ sns.set(color_codes=True)
8
+
9
+
10
+ def run():
11
+ # Read the dataset
12
+ df = pd.read_csv("Toyota.csv")
13
+
14
+ # 1. Calculate percentage of missing values
15
+ missing = df.isnull().sum()
16
+ percentage = (missing / len(df)) * 100
17
+
18
+ print("Percentage of missing values:")
19
+ print(percentage)
20
+
21
+ # 2. Replace missing values with mean if below 10%
22
+ for col in df.columns:
23
+ if df[col].isnull().sum() / len(df) * 100 < 10:
24
+ if df[col].dtype != "object":
25
+ df[col] = df[col].fillna(df[col].mean())
26
+ else:
27
+ print("High missing percentage:", col)
28
+
29
+ # 3. Mode imputation for categorical data
30
+ common = df.apply(
31
+ lambda x: x.fillna(x.value_counts().index[0])
32
+ if not x.value_counts().empty else x
33
+ )
34
+
35
+ print("\nAfter mode imputation:")
36
+ print(common.head())
37
+
38
+ print("\nFuel types:")
39
+ print(df["FuelType"].unique())
40
+
41
+ # 4. Nearest interpolation for numeric missing values
42
+ for col in percentage.index:
43
+ if percentage[col] < 10 and pd.api.types.is_numeric_dtype(df[col]):
44
+ df[col] = df[col].interpolate(method="nearest")
45
+
46
+ # 5. Drop columns with more than 10% missing values
47
+ for col in df.columns.tolist():
48
+ if df[col].isnull().sum() * 100 / len(df) > 10:
49
+ df.drop(columns=[col], inplace=True)
50
+ print(col, "Dropped")
51
+
52
+ print("\nShape of dataset:", df.shape)
53
+
54
+ # 6. Drop rows with outlier Z-score greater than 4
55
+ threshold = 4
56
+ temp = df["Doors"].copy()
57
+
58
+ mean = np.mean(temp)
59
+ std = np.std(temp)
60
+
61
+ if std != 0:
62
+ z_scores = (temp - mean) / std
63
+ outlier_indices = z_scores[z_scores > threshold].index
64
+ df.drop(index=outlier_indices, inplace=True)
65
+
66
+ for z in z_scores.loc[outlier_indices]:
67
+ print(z, "row dropped")
68
+
69
+ print("\nDoors column:")
70
+ print(df["Doors"].head())
71
+
72
+ # 7. Drop duplicate rows based on HP
73
+ df = (
74
+ df.sort_values("KM", ascending=False)
75
+ .drop_duplicates("HP")
76
+ .sort_index()
77
+ )
78
+
79
+ # 8. Min-max normalization for Price
80
+ plt.title("Min-Max Normalization")
81
+ price = df["Price"]
82
+
83
+ xscal = (price - price.min()) / (price.max() - price.min())
84
+
85
+ sns.scatterplot(x=price, y=xscal)
86
+ plt.xlabel("Price")
87
+ plt.ylabel("Normalized Price")
88
+ plt.show()
89
+
90
+ # 9. One-hot encoding for FuelType
91
+ onehot = df["FuelType"]
92
+ dum = pd.get_dummies(onehot)
93
+
94
+ print("\nOne-hot encoded data:")
95
+ print(dum.head())
96
+
97
+
98
+ if __name__ == "__main__":
99
+ run()
@@ -0,0 +1,46 @@
1
+
2
+ import numpy as np
3
+
4
+ from sklearn import datasets
5
+ from sklearn.model_selection import train_test_split
6
+ from sklearn.preprocessing import StandardScaler
7
+ from sklearn.linear_model import Perceptron
8
+ from sklearn.metrics import accuracy_score
9
+
10
+
11
+ def run():
12
+ # Load Iris dataset
13
+ iris = datasets.load_iris()
14
+ X = iris.data
15
+ y = iris.target
16
+
17
+ # Split dataset into training and testing
18
+ X_train, X_test, y_train, y_test = train_test_split(
19
+ X, y, test_size=0.2, random_state=42
20
+ )
21
+
22
+ # Standardize the features
23
+ sc = StandardScaler()
24
+ X_train_std = sc.fit_transform(X_train)
25
+ X_test_std = sc.transform(X_test)
26
+
27
+ # Create a single-layer perceptron classifier
28
+ perceptron = Perceptron(
29
+ max_iter=100,
30
+ eta0=0.1,
31
+ random_state=0
32
+ )
33
+
34
+ # Train the classifier
35
+ perceptron.fit(X_train_std, y_train)
36
+
37
+ # Make predictions
38
+ y_pred = perceptron.predict(X_test_std)
39
+
40
+ # Calculate accuracy
41
+ accuracy = accuracy_score(y_test, y_pred)
42
+ print(f"Accuracy: {accuracy:.2f}")
43
+
44
+
45
+ if __name__ == "__main__":
46
+ run()
pico_lab/svr.py ADDED
@@ -0,0 +1,68 @@
1
+
2
+ import numpy as np
3
+ import pandas as pd
4
+ import matplotlib.pyplot as plt
5
+ import seaborn as sns
6
+
7
+ from sklearn import datasets
8
+ from sklearn.model_selection import train_test_split
9
+ from sklearn.svm import SVR
10
+ from sklearn.metrics import mean_squared_error, r2_score
11
+
12
+
13
+ def run():
14
+ # Load Iris dataset
15
+ iris = datasets.load_iris()
16
+ X = iris.data
17
+ y = iris.target
18
+
19
+ # Create DataFrame
20
+ iris_df = pd.DataFrame(
21
+ data=np.c_[iris["data"], iris["target"]],
22
+ columns=iris["feature_names"] + ["target"]
23
+ )
24
+
25
+ print(iris_df.head(150))
26
+ print(iris_df.info())
27
+ print(iris_df.describe())
28
+
29
+ # Check unique values in target column
30
+ print("\nUnique target values:")
31
+ print(iris_df["target"].unique())
32
+
33
+ # Select regression target (second feature)
34
+ y_regression = X[:, 1]
35
+
36
+ # Pair plot
37
+ sns.pairplot(iris_df, hue="target", palette="rainbow")
38
+ plt.show()
39
+
40
+ # Split dataset
41
+ X_train, X_test, y_train, y_test = train_test_split(
42
+ X, y_regression, test_size=0.1, random_state=42
43
+ )
44
+
45
+ # Create and train SVR model
46
+ svr = SVR(kernel="linear")
47
+ svr.fit(X_train, y_train)
48
+
49
+ # Predict results
50
+ y_pred = svr.predict(X_test)
51
+
52
+ # Evaluate model
53
+ mse = mean_squared_error(y_test, y_pred)
54
+ r2 = r2_score(y_test, y_pred)
55
+
56
+ print("Mean squared error:", mse)
57
+ print("R-squared:", r2)
58
+
59
+ # Visualize actual vs predicted values
60
+ plt.scatter(y_test, y_pred)
61
+ plt.xlabel("Actual sepal width")
62
+ plt.ylabel("Predicted sepal width")
63
+ plt.title("SVR: Actual vs Predicted Sepal Width")
64
+ plt.show()
65
+
66
+
67
+ if __name__ == "__main__":
68
+ run()
@@ -0,0 +1,78 @@
1
+ Metadata-Version: 2.4
2
+ Name: pico-lab
3
+ Version: 0.1.0
4
+ Summary: AI and Machine Learning Laboratory Toolkit for Robotics
5
+ License-Expression: MIT
6
+ Keywords: artificial-intelligence,machine-learning,robotics,laboratory,python
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Programming Language :: Python :: 3 :: Only
9
+ Classifier: Programming Language :: Python :: 3.9
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
14
+ Classifier: Topic :: Education
15
+ Requires-Python: >=3.9
16
+ Description-Content-Type: text/markdown
17
+ Requires-Dist: numpy
18
+ Requires-Dist: pandas
19
+ Requires-Dist: matplotlib
20
+ Requires-Dist: seaborn
21
+ Requires-Dist: scikit-learn
22
+
23
+
24
+ # Pico Lab
25
+
26
+ AI and Machine Learning Laboratory Toolkit for Robotics.
27
+
28
+ Pico Lab is a Python package that provides source code for 12 AI and Machine Learning laboratory experiments.
29
+
30
+ ## Installation
31
+
32
+ ```bash
33
+ pip install pico-lab
34
+ ```
35
+
36
+ ## Usage
37
+
38
+ Run the following command:
39
+
40
+ ```bash
41
+ pico-lab
42
+ ```
43
+
44
+ Select an experiment number to display its complete Python source code.
45
+
46
+ ## Experiments
47
+
48
+ 1. Exploratory Data Analysis (EDA)
49
+ 2. Data Pre-processing
50
+ 3. Linear Regression Models
51
+ 4. Single Layer Perceptron Algorithm
52
+ 5. Multiple Layer Perceptron Training
53
+ 6. KNN Classifier
54
+ 7. Support Vector Regression
55
+ 8. Primitive Operations on Fuzzy Sets
56
+ 9. Naive Bayes Classifier
57
+ 10. K-Means Clustering
58
+ 11. Robotic Application using Depth First Search
59
+ 12. Robotic Application using Breadth First Search
60
+
61
+ ## Requirements
62
+
63
+ - Python 3.9 or higher
64
+ - NumPy
65
+ - Pandas
66
+ - Matplotlib
67
+ - Seaborn
68
+ - Scikit-learn
69
+
70
+ ## Dataset
71
+
72
+ Experiments 1 and 2 require the Toyota.csv dataset.
73
+
74
+ Other experiments use built-in datasets or predefined examples.
75
+
76
+ ## License
77
+
78
+ MIT License
@@ -0,0 +1,19 @@
1
+ pico_lab/__init__.py,sha256=Mi1Tnk119fPOCfxXqCRHS-WFn52LDULoZ-BjZqsDy8c,25
2
+ pico_lab/bfs.py,sha256=cOyZi41VFoJaCVyBT2eOOlUp4DceCNT3m1bOk8WVsHs,683
3
+ pico_lab/cli.py,sha256=ftLdgm0bFB9brylZCVW3CpYYBWQ0tG0ReISkwOls0wY,1681
4
+ pico_lab/dfs.py,sha256=j5jOFq7ok5RZoU0pZMEajpEUdaOY9aWbiBfTahTEekc,635
5
+ pico_lab/eda.py,sha256=HeGBA_7LAQgJ4k8poCpoPgTYD1K4UN96X1_h_H47kNM,2302
6
+ pico_lab/fuzzy_sets.py,sha256=KRBYrCCdptwjL83jrLVq3n5psT0Iad0GIz8XvM0bFKA,1678
7
+ pico_lab/kmeans.py,sha256=uTdvZF8MEqt76e_oLpp3F8F0Bu3Pul9Jc2Sadl3EnSw,1279
8
+ pico_lab/knn.py,sha256=evRc_C-Y27BwezBOHynftJb3F6A3iZ7sh03g1XgLKyE,1142
9
+ pico_lab/linear_regression.py,sha256=dHuhiOcE-5Qn63HPjopkx5skG29phTjS1Ci2xoCjdp4,1670
10
+ pico_lab/mlp.py,sha256=CMvHStFRRi_krOvcqTnlvqWRktmrWgOzwDKg2XkFuzs,958
11
+ pico_lab/naive_bayes.py,sha256=BBK9gXy6jTLczjgFCMreFJOGTa79L25HT35kjg-hXVs,1163
12
+ pico_lab/preprocessing.py,sha256=fm5L0FHz5SabcIqvQRKI6jmnCe6Zq7EpsBK1wRibBkc,2702
13
+ pico_lab/single_perceptron.py,sha256=Y0WCLIeh9_df8QeQ72O1P_-EftWZ-OEr9pemyg5LesI,1123
14
+ pico_lab/svr.py,sha256=MpG7GZxhvIksNbaNrn1Apxntmd7NypofCKQ6PDJ8e34,1688
15
+ pico_lab-0.1.0.dist-info/METADATA,sha256=UMxHrQlpNx2QbbeLPWPUL0lyF2ugCYIuNRv0ba3Z3_s,1918
16
+ pico_lab-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
17
+ pico_lab-0.1.0.dist-info/entry_points.txt,sha256=aC1ks7YKVWyCgJVnR_7VQcdnz3AnHsgx8fkKWaE-g68,47
18
+ pico_lab-0.1.0.dist-info/top_level.txt,sha256=FnZsLhF85Hj-0DoZtp05mPSpsRyMpi1Kq3CMdij--kA,9
19
+ pico_lab-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ pico-lab = pico_lab.cli:main
@@ -0,0 +1 @@
1
+ pico_lab