What the syllabus asked for
The repo is called Academic-Data-Mining-Lab-Exercies-Files. Yes, "Exercies". I noticed the typo the day I created it and never fixed it. The README is one sentence: "Files from Data Mining Lab from Academic study." Eleven commits, all landing on 2022-10-05, in the shape of somebody uploading a semester's worth of lab work the night before it was due. The 2025-07-24 push date GitHub shows is a later README touch-up, not fresh code.
The lab covered four algorithms: decision tree, k-means, Naive Bayes, and a neural network. Every algorithm had to be turned in twice. Once in Python, with sklearn or hand-rolled numpy. Once in Java, using Weka. Same data, same model, two ecosystems.
Two ecosystems, same model
Weka is a Java GUI application out of the University of Waikato that predates the modern Python stack. It ships weka.classifiers.* and weka.clusterers.* classes, ARFF as its native dataset format, and a workbench you can click through. It was the standard for data-mining coursework in the 2000s and it still shows up in Indian university syllabi because the textbook most departments teach from, Han and Kamber, uses Weka as the reference tool.
sklearn is the Python stack you already know. DecisionTreeClassifier, GaussianNB, train_test_split, LabelEncoder. Pandas for the frame, numpy for the arrays, matplotlib for the picture.
Making an undergrad implement the same algorithm in both is a reasonable teaching move. Weka forces you to think about the model as an object with a buildClassifier(Instances) method that mutates state, and about the data as Instances with typed attributes declared up front in the ARFF header. sklearn hides that surface. You call fit(X, y) with a numpy array and a pandas Series and the framework figures out what the columns are supposed to mean. Seeing both, back to back, is how you learn what a classifier actually is.
What I remember is finishing the Python version, closing the notebook, opening IntelliJ, and copy-pasting whatever the Weka JavaDoc had into my project until it compiled. The Java side felt like a chore. The Python side felt like the thing.
What breaks when you look at a five-year-old lab dump
The repo is 21 items, flat, no folders. Seven code files, four datasets, four PDF lab reports, four .docx mirrors of the same reports, the README, and a couple of stray helpers. Reading through the code today, a few things surface immediately.
The Python scripts read data from a hardcoded Colab path: /content/drive/MyDrive/Colab Notebooks/drug200.csv. That path only exists inside my Google Drive. If you clone the repo and try to run any of the Python files, they crash on the first read.
The Java files carry Windows absolute paths from the desktop of a machine I no longer own: C:\\Users\\kaush\\Desktop\\.... reptree.java even points at a path that includes a gist hash, 8836201-6f9306ad..., which suggests I copied the file from a gist someone shared and never rewrote the string. Every Java file wraps its entire body in a try and swallows the exception with catch (Exception e) { }. If anything went wrong at runtime, nobody would ever know.
decisiontree.py is not a decision tree. It imports GaussianNB from sklearn and trains a Naive Bayes classifier. The filename says one thing and the code does another. I suspect what happened is that I copy-pasted from naivebayes.py, changed the filename to match the current exercise, and forgot to change the import. Then I submitted it. Then I uploaded it to GitHub. Then I moved on.
neural.java imports NaiveBayes at the top, constructs a MultilayerPerceptron, sets up 10-fold cross-validation, and then the buildClassifier call is commented out. So the file compiles, prints the header, and never actually trains anything. I do not remember why I commented that line. Best guess is the classifier was too slow on my laptop and I wanted the report done by midnight.
The J48 decision tree is imported at the top of two Java files and never used. I think the original template I copied from had it, and the removal never made it into my fork.
k-means from scratch, next to a one-line Weka call
The one file in the repo with any craft in it is clustering.py. Around 52 lines. K-means from scratch. No sklearn. Eight points, three centroids seeded at (2, 10), (5, 8), and (1, 2). A short inline Euclidean distance calculation, no separate helper. An outer loop that reassigns points to their nearest centroid, an inner block that recomputes each centroid as the mean of its assigned points, and a termination check when the centroids stop moving.
# inline in the loop, roughly
dist = ((p[0] - c[0])**2 + (p[1] - c[1])**2) ** 0.5Two dimensions, no vectorisation, no numpy, no math import. The equivalent Weka version is one line:
SimpleKMeans kmeans = new SimpleKMeans();
kmeans.setNumClusters(3);
kmeans.buildClusterer(data);Same algorithm, same dataset, same three centroids. One implementation is roughly 50 lines of raw arithmetic and the other is three lines of framework calls. The Python file is more honest about what k-means is doing. The Java file is what production code looks like when somebody has already written the algorithm and you are just wiring it up.
Iris and drug200, the two teaching sets
Every intro data-mining lab uses Iris. Mine did too. iris.csv is 150 rows, three balanced classes of 50, four continuous features. It has been the flat-file classifier benchmark since Fisher published it in 1936. If your model cannot separate Iris, your model is broken. If it can, you have proven very little. But it is the smallest possible dataset where a decision boundary is real, and that is why it will not go away.
The other dataset is drug200.csv. Two hundred rows, five features, five drug labels. Age is continuous. Sex, blood pressure, and cholesterol are categorical. Na-to-K ratio is continuous again. The interesting thing about drug200 for an undergrad is that it forces you to encode categorical variables before sklearn will accept them. That is what LabelEncoder shows up for in the Python files. In the Weka side, ARFF declares the categorical attributes in the header and the framework does the encoding for you.
What the flow looked like, per algorithm
<Mermaid chart={flowchart LR A[Algorithm from the syllabus] --> B[Python track: sklearn or numpy] A --> C[Java track: Weka classifier] B --> D[Screenshots of console output] C --> D D --> E[Lab report PDF and DOCX mirror]} />
Every one of the four algorithms went through this same shape. Two implementations, one document, submitted as a PDF and its Word twin.
What I would fix if I were re-submitting today
A README.md that names the four algorithms, links each of them to its Python file and its Java file, and lists the datasets. A data/ subfolder for the CSV and ARFF files. A requirements.txt pinning sklearn, pandas, and matplotlib. Rename decisiontree.py to naivebayes.py or swap the import for DecisionTreeClassifier. Delete the unused J48 import. Uncomment buildClassifier in neural.java. Replace every C:\Users\kaush\Desktop\... and every /content/drive/MyDrive/... with a relative path. Wrap the Java files in real error handling instead of silent catch blocks. Use the Weka CLI, java -cp weka.jar weka.classifiers.trees.REPTree -t data.arff, and put the invocations in a shell script.
I am not going to do any of that. The repo is what it was on 2022-10-05 and moving it now would be dishonest about what it is. It is a lab dump. It got me a grade. The point of putting it here is to be clear about what those four PDFs cost me and what they taught, which is: a data-mining course teaches you the model, and if you are lucky the tooling teaches you the rest.