├── Dockerfile ├── README.md ├── app.py └── requirements.txt /Dockerfile: -------------------------------------------------------------------------------- 1 | # Use an official Python runtime as a parent image 2 | FROM python:3.6-slim 3 | 4 | # Set the working directory to /app 5 | WORKDIR /app 6 | 7 | # Copy the current directory contents into the container at /app 8 | ADD . /app 9 | 10 | # Install any needed packages specified in requirements.txt 11 | RUN pip install -r requirements.txt 12 | 13 | # Make port 80 available to the world outside this container 14 | #EXPOSE 80 15 | 16 | # Define environment variable 17 | ENV NAME World 18 | 19 | # Run app.py when the container launches 20 | CMD ["python", "app.py"] 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Docker_Python_DataScience 2 | Some DataScience Test with docker + python + SciKit-learn 3 | 4 |

Version 1

5 | 11 | 12 | app.py: 13 | 14 | Uses scikit-learn machine learning library (from requirements.txt) and takes sample fruit dataset (height,weight,texture) and predicts the fruit based on the input dataset. 15 | 16 | #Docker 17 | #Python 18 | #SciKit-learn 19 | #MachineLearning 20 | -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | from sklearn import tree 2 | from sklearn import neighbors 3 | 4 | #[size,weight, texture] 5 | X = [[181, 80, 44], [177, 70, 43], [160, 60, 38], [154, 54, 37], [166, 65, 40], 6 | [190, 90, 47], [175, 64, 39], 7 | [177, 70, 40], [159, 55, 37], [171, 75, 42], [181, 85, 43]] 8 | 9 | Y = ['apple', 'apple', 'orange', 'orange', 'apple', 'apple', 'orange', 'orange', 10 | 'orange', 'apple', 'apple'] 11 | 12 | #classifier - DecisionTreeClassifier 13 | clf_tree = tree.DecisionTreeClassifier(); 14 | clf_tree = clf_tree.fit(X,Y); 15 | 16 | #classifier - neighbour 17 | clf_neighbors = neighbors.KNeighborsClassifier(); 18 | clf_neighbors = clf_neighbors.fit(X,Y); 19 | 20 | #test_data 21 | test_data = [[190,70,42],[172,64,39],[182,80,42]]; 22 | 23 | #prediction 24 | prediction_tree = clf_tree.predict(test_data); 25 | prediction_neighbors = clf_neighbors.predict(test_data); 26 | 27 | print("prediction of DecisionTreeClassifier:",prediction_tree); 28 | 29 | print("prediction of Neighour:",prediction_neighbors); 30 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | numpy 2 | scipy 3 | scikit-learn 4 | --------------------------------------------------------------------------------