DjPractLelo 0.2.1__tar.gz → 0.2.3__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.
- djpractlelo-0.2.3/DjPractLelo/resource_loader.py +46 -0
- djpractlelo-0.2.3/DjPractLelo/resources/ClassificationModel.py +28 -0
- djpractlelo-0.2.3/DjPractLelo/resources/LogisticRegression.py +46 -0
- djpractlelo-0.2.3/DjPractLelo/resources/MONGODB.py +46 -0
- djpractlelo-0.2.3/DjPractLelo/resources/MultipleRegression.py +48 -0
- djpractlelo-0.2.3/DjPractLelo/resources/SVM.py +20 -0
- djpractlelo-0.2.3/DjPractLelo/resources/Titanic-Dataset.csv +892 -0
- djpractlelo-0.2.3/DjPractLelo/resources/cluster(a).py +29 -0
- djpractlelo-0.2.3/DjPractLelo/resources/desicion_tree.py +41 -0
- djpractlelo-0.2.3/DjPractLelo/resources/mapreduced(weather).py +34 -0
- djpractlelo-0.2.3/DjPractLelo/resources/mapreduced(wordcount).py +26 -0
- djpractlelo-0.2.3/DjPractLelo/resources/students.csv +9 -0
- djpractlelo-0.2.3/DjPractLelo/resources/titanic_analysis (1).py +74 -0
- djpractlelo-0.2.3/DjPractLelo/resources/weather(3).csv +17 -0
- {djpractlelo-0.2.1 → djpractlelo-0.2.3}/DjPractLelo.egg-info/PKG-INFO +1 -1
- djpractlelo-0.2.3/DjPractLelo.egg-info/SOURCES.txt +25 -0
- djpractlelo-0.2.3/LICENCE +0 -0
- djpractlelo-0.2.3/MANIFEST.in +2 -0
- {djpractlelo-0.2.1 → djpractlelo-0.2.3}/PKG-INFO +1 -1
- {djpractlelo-0.2.1 → djpractlelo-0.2.3}/pyproject.toml +4 -3
- {djpractlelo-0.2.1 → djpractlelo-0.2.3}/setup.py +1 -1
- djpractlelo-0.2.1/DjPractLelo/resource_loader.py +0 -35
- djpractlelo-0.2.1/DjPractLelo/resources/AP_pract2.txt +0 -104
- djpractlelo-0.2.1/DjPractLelo/resources/AP_pract5UiComponent,fragment,Appbar.txt +0 -141
- djpractlelo-0.2.1/DjPractLelo/resources/Activity Life Cycle.txt +0 -44
- djpractlelo-0.2.1/DjPractLelo/resources/Broadcast receivers.txt +0 -41
- djpractlelo-0.2.1/DjPractLelo/resources/Database Programming with SQLite.txt +0 -137
- djpractlelo-0.2.1/DjPractLelo/resources/Dialog and Dialog Fragments.txt +0 -122
- djpractlelo-0.2.1/DjPractLelo/resources/Intents and EventListener,Adapters.txt +0 -114
- djpractlelo-0.2.1/DjPractLelo/resources/LayoutGridview with linear layout.txt +0 -181
- djpractlelo-0.2.1/DjPractLelo/resources/LayoutListview.txt +0 -45
- djpractlelo-0.2.1/DjPractLelo/resources/Menu.txt +0 -132
- djpractlelo-0.2.1/DjPractLelo/resources/Multiple Activity.txt +0 -32
- djpractlelo-0.2.1/DjPractLelo/resources/Multiple Fragment.txt +0 -70
- djpractlelo-0.2.1/DjPractLelo/resources/Notification.txt +0 -64
- djpractlelo-0.2.1/DjPractLelo/resources/Programming Media API and Teleph.txt +0 -75
- djpractlelo-0.2.1/DjPractLelo/resources/Programming Security and permiss.txt +0 -37
- djpractlelo-0.2.1/DjPractLelo/resources/Programming threads, handles and as.txt +0 -44
- djpractlelo-0.2.1/DjPractLelo/resources/Services.txt +0 -37
- djpractlelo-0.2.1/DjPractLelo/resources/b. Fragment Life Cycle.txt +0 -51
- djpractlelo-0.2.1/DjPractLelo.egg-info/SOURCES.txt +0 -29
- djpractlelo-0.2.1/MANIFEST.in +0 -1
- {djpractlelo-0.2.1 → djpractlelo-0.2.3}/DjPractLelo/__init__.py +0 -0
- /djpractlelo-0.2.1/LICENCE → /djpractlelo-0.2.3/DjPractLelo/resources/titanic_analysis.py +0 -0
- {djpractlelo-0.2.1 → djpractlelo-0.2.3}/DjPractLelo.egg-info/dependency_links.txt +0 -0
- {djpractlelo-0.2.1 → djpractlelo-0.2.3}/DjPractLelo.egg-info/top_level.txt +0 -0
- {djpractlelo-0.2.1 → djpractlelo-0.2.3}/README.md +0 -0
- {djpractlelo-0.2.1 → djpractlelo-0.2.3}/setup.cfg +0 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from importlib.resources import files
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
# Base resources directory
|
|
5
|
+
BASE_RESOURCES = files("DjPractLelo") / "resources"
|
|
6
|
+
|
|
7
|
+
ALLOWED_EXTENSIONS = (".py", ".csv")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def get_file(category: str, filename: str) -> Path:
|
|
11
|
+
"""
|
|
12
|
+
Get a specific PY or CSV file from a category.
|
|
13
|
+
category: 'data_science' or 'soft_computing'
|
|
14
|
+
"""
|
|
15
|
+
if not filename.endswith(ALLOWED_EXTENSIONS):
|
|
16
|
+
raise ValueError("Only .py and .csv files are allowed")
|
|
17
|
+
|
|
18
|
+
return BASE_RESOURCES / category / filename
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def list_files(category: str) -> list[Path]:
|
|
22
|
+
"""
|
|
23
|
+
List all PY and CSV files in a category.
|
|
24
|
+
"""
|
|
25
|
+
directory = BASE_RESOURCES / category
|
|
26
|
+
return [p for p in directory.iterdir() if p.suffix in ALLOWED_EXTENSIONS]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def load_csv(filename: str, category: str = "data_science") -> str:
|
|
30
|
+
"""
|
|
31
|
+
Read a CSV file and return its content as text.
|
|
32
|
+
"""
|
|
33
|
+
path = get_file(category, filename)
|
|
34
|
+
|
|
35
|
+
with open(path, "r", encoding="utf-8") as f:
|
|
36
|
+
return f.read()
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def load_py(filename: str, category: str = "soft_computing") -> str:
|
|
40
|
+
"""
|
|
41
|
+
Read a PY file and return its code as text.
|
|
42
|
+
"""
|
|
43
|
+
path = get_file(category, filename)
|
|
44
|
+
|
|
45
|
+
with open(path, "r", encoding="utf-8") as f:
|
|
46
|
+
return f.read()
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from sklearn.tree import DecisionTreeClassifier
|
|
2
|
+
|
|
3
|
+
# Student Names
|
|
4
|
+
students = ["Sam", "Nidhi", "Tejas", "Ricky", "Sai",
|
|
5
|
+
"Kamlii", "vinay", "Dharmesh", "Mitu", "Roma"]
|
|
6
|
+
|
|
7
|
+
# Features: [Marks, Attendance]
|
|
8
|
+
X = [[35,60],[40,65],[75,85],[80,90],[55,70],
|
|
9
|
+
[30,50],[90,95],[45,60],[70,80],[25,40]]
|
|
10
|
+
|
|
11
|
+
# Target
|
|
12
|
+
y = ["Fail","Fail","Pass","Pass","Pass",
|
|
13
|
+
"Fail","Pass","Fail","Pass","Fail"]
|
|
14
|
+
|
|
15
|
+
# Train Classifier
|
|
16
|
+
dt = DecisionTreeClassifier()
|
|
17
|
+
dt.fit(X, y)
|
|
18
|
+
|
|
19
|
+
# Predict result for a new student
|
|
20
|
+
student_name = "Sam"
|
|
21
|
+
new_student = [[75, 80]] # Marks, Attendance
|
|
22
|
+
|
|
23
|
+
result = dt.predict(new_student)
|
|
24
|
+
|
|
25
|
+
print("Student Name :", student_name)
|
|
26
|
+
print("Marks :", new_student[0][0])
|
|
27
|
+
print("Attendance :", new_student[0][1], "%")
|
|
28
|
+
print("Prediction :", result[0])
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Import libraries
|
|
2
|
+
import pandas as pd
|
|
3
|
+
from sklearn.linear_model import LogisticRegression
|
|
4
|
+
|
|
5
|
+
# Create dataset
|
|
6
|
+
data = {
|
|
7
|
+
"Name": ["Sam", "Nidhi", "Tejas", "Ricky", "Sai"],
|
|
8
|
+
"GRE": [750, 600, 700, 500, 650],
|
|
9
|
+
"GPA": [3.8, 3.2, 3.6, 2.8, 3.4],
|
|
10
|
+
"Rank": [1, 2, 1, 4, 3],
|
|
11
|
+
"Admit": [1, 1, 1, 0, 0]
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
df = pd.DataFrame(data)
|
|
15
|
+
|
|
16
|
+
# Features and target
|
|
17
|
+
X = df[["GRE", "GPA", "Rank"]]
|
|
18
|
+
y = df["Admit"]
|
|
19
|
+
|
|
20
|
+
# Train model
|
|
21
|
+
model = LogisticRegression()
|
|
22
|
+
model.fit(X, y)
|
|
23
|
+
|
|
24
|
+
# Input new student details
|
|
25
|
+
name = input("Enter Student Name: ")
|
|
26
|
+
gre = int(input("Enter GRE Score: "))
|
|
27
|
+
gpa = float(input("Enter GPA: "))
|
|
28
|
+
rank = int(input("Enter College Rank (1-4): "))
|
|
29
|
+
|
|
30
|
+
# Create DataFrame for prediction
|
|
31
|
+
new_student = pd.DataFrame({
|
|
32
|
+
"GRE": [gre],
|
|
33
|
+
"GPA": [gpa],
|
|
34
|
+
"Rank": [rank]
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
# Predict admission
|
|
38
|
+
result = model.predict(new_student)
|
|
39
|
+
|
|
40
|
+
# Display result
|
|
41
|
+
print("\nStudent Name:", name)
|
|
42
|
+
|
|
43
|
+
if result[0] == 1:
|
|
44
|
+
print("Admission Status: Admitted")
|
|
45
|
+
else:
|
|
46
|
+
print("Admission Status: Not Admitted")
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from pymongo import MongoClient
|
|
2
|
+
import pandas as pd
|
|
3
|
+
|
|
4
|
+
client = MongoClient("mongodb://localhost:27017/")
|
|
5
|
+
db = client["BigDataDB"]
|
|
6
|
+
collection = db["StudentData"]
|
|
7
|
+
|
|
8
|
+
df = pd.read_csv("students.csv")
|
|
9
|
+
|
|
10
|
+
print("\nOriginal CSV Data:\n")
|
|
11
|
+
print(df)
|
|
12
|
+
|
|
13
|
+
data = df.to_dict(orient="records")
|
|
14
|
+
|
|
15
|
+
collection.delete_many({})
|
|
16
|
+
|
|
17
|
+
collection.insert_many(data)
|
|
18
|
+
|
|
19
|
+
print("\nCSV Data Inserted into MongoDB Successfully\n")
|
|
20
|
+
|
|
21
|
+
records = list(collection.find())
|
|
22
|
+
|
|
23
|
+
mongo_df = pd.DataFrame(records)
|
|
24
|
+
|
|
25
|
+
mongo_df = mongo_df.drop(columns=["_id"])
|
|
26
|
+
|
|
27
|
+
print("Data Read From MongoDB:\n")
|
|
28
|
+
print(mongo_df)
|
|
29
|
+
mongo_df["Marks"] = mongo_df["Marks"] + 5
|
|
30
|
+
filtered = mongo_df[mongo_df["Marks"] > 85]
|
|
31
|
+
sorted_data = filtered.sort_values(by="Marks", ascending=False)
|
|
32
|
+
print("\nManipulated Data:\n")
|
|
33
|
+
print(sorted_data)
|
|
34
|
+
|
|
35
|
+
for index, row in sorted_data.iterrows():
|
|
36
|
+
collection.update_one(
|
|
37
|
+
{"Name": row["Name"]},
|
|
38
|
+
{"$set": {"Marks": int(row["Marks"])}}
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
print("\nMongoDB Updated Successfully\n")
|
|
42
|
+
|
|
43
|
+
print("Final Data From MongoDB:\n")
|
|
44
|
+
|
|
45
|
+
for record in collection.find({}, {"_id": 0}):
|
|
46
|
+
print(record)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
from sklearn.linear_model import LinearRegression
|
|
2
|
+
|
|
3
|
+
# Student Names
|
|
4
|
+
students = ["Sam", "Nidhi", "Tejas", "Ricky", "sai",
|
|
5
|
+
"Kamlesh", "Vinay", "Dharmesh", "Mitu", "Roma"]
|
|
6
|
+
|
|
7
|
+
# Features: [Study Hours, Attendance]
|
|
8
|
+
X = [
|
|
9
|
+
[3,60],
|
|
10
|
+
[3,65],
|
|
11
|
+
[6,85],
|
|
12
|
+
[7,90],
|
|
13
|
+
[5,70],
|
|
14
|
+
[1,50],
|
|
15
|
+
[8,95],
|
|
16
|
+
[3,60],
|
|
17
|
+
[6,80],
|
|
18
|
+
[1,40]
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
# Final Marks
|
|
22
|
+
y = [80,90,45,80,55,30,20,45,30,25]
|
|
23
|
+
|
|
24
|
+
# Train Model
|
|
25
|
+
model = LinearRegression()
|
|
26
|
+
model.fit(X, y)
|
|
27
|
+
|
|
28
|
+
# Display existing students and results
|
|
29
|
+
print("Student Results")
|
|
30
|
+
print("-" * 40)
|
|
31
|
+
|
|
32
|
+
for i in range(len(students)):
|
|
33
|
+
result = "Pass" if y[i] >= 40 else "Fail"
|
|
34
|
+
print(students[i], "- Marks:", y[i], "-", result)
|
|
35
|
+
|
|
36
|
+
# Predict for a new student
|
|
37
|
+
new_student_name = "Nidhi"
|
|
38
|
+
new_student = [[4,75]]
|
|
39
|
+
|
|
40
|
+
predicted_marks = model.predict(new_student)[0]
|
|
41
|
+
|
|
42
|
+
result = "Pass" if predicted_marks >= 40 else "Fail"
|
|
43
|
+
|
|
44
|
+
print("\nNew Student Prediction")
|
|
45
|
+
print("-" * 40)
|
|
46
|
+
print("Name:", new_student_name)
|
|
47
|
+
print("Predicted Marks:", round(predicted_marks, 2))
|
|
48
|
+
print("Result:", result)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from sklearn.svm import SVC
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
x = [[80,20],[65,25],[40,60],[65,45],[85,95]]
|
|
5
|
+
y = ["Pass","Fail","Pass","Fail","Pass"]
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
model = SVC()
|
|
9
|
+
model.fit(x, y)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
Name = input("Enter your Name: ")
|
|
13
|
+
Marks = int(input("Enter your Marks: "))
|
|
14
|
+
Attendance = int(input("Enter your Attendance: "))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
result = model.predict([[Marks, Attendance]])
|
|
18
|
+
|
|
19
|
+
print("Name:", Name)
|
|
20
|
+
print("Result:", result[0])
|