Skip to content

[pull] master from collabnix:master #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions Tutorials/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Python base image

FROM python:3.9-slim



# Set the working directory inside the container

WORKDIR /app



# Copy the Python script into the container

COPY code_1.py .



# Install any necessary dependencies

RUN pip install pandas matplotlib scikit-learn



# Command to run the Python script when the container starts

CMD ["python", "code_1.py"]
65 changes: 65 additions & 0 deletions Tutorials/intro_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import pandas as pd

import matplotlib.pyplot as plt

from sklearn.datasets import load_iris

from sklearn.model_selection import train_test_split

from sklearn.ensemble import RandomForestClassifier

from sklearn.metrics import accuracy_score



# Load the Iris dataset

iris = load_iris()

data = pd.DataFrame(data=iris.data, columns=iris.feature_names)

target = pd.Series(data=iris.target)



# Data Exploration

print("Dataset Description:")

print(data.describe())



# Data Visualization

data.plot(kind='box', subplots=True, layout=(2, 2), sharex=False, sharey=False)

plt.show()



# Train-test split

X_train, X_test, y_train, y_test = train_test_split(data, target, test_size=0.2, random_state=42)



# Train a Random Forest Classifier

rf_classifier = RandomForestClassifier(n_estimators=100, random_state=42)

rf_classifier.fit(X_train, y_train)



# Make predictions

y_pred = rf_classifier.predict(X_test)



# Calculate accuracy

accuracy = accuracy_score(y_test, y_pred)

print("Accuracy:", accuracy)
10 changes: 10 additions & 0 deletions Tutorials/step3tostep7.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
docker build -t data_science_image .
docker run -it data_science_image
docker build -t myimage:1.0
python script_1.py
docker exec -it <container_name> python /path/to/code_1.py
docker login
docker tag data_science_image collabnix12/data_science_image:v1.0
docker push collabnix12/data_science_image:v1.0
docker pull collabnix12/data_science_image:v1.0
docker run -it collabnix12/data_science_image:v1.0
2 changes: 1 addition & 1 deletion presentation/docker_workshop_1.html
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ <h2> 8.Managing Docker containers </h2>

</section>
<section>
<p> Show all the containers (includind non running containers): </p>
<p> Show all the containers (including non running containers): </p>
<pre><code class="hljs" data-trim contenteditable>
docker ps -a
</code></pre>
Expand Down
Loading