w1coding.comAll tutorials

Machine Learning Environment Setup

Machine Learning lessons
  1. Environment Setup
  2. Introduction To Machine Learning
  3. Types Of Machine Learning
  4. Supervised Learning Basics
  5. Unsupervised Learning Basics
  6. Reinforcement Learning Introduction
  7. Installing Python And Libraries
  8. Understanding Datasets
  9. Data Preprocessing
  10. Exploratory Data Analysis
  11. Feature Engineering
  12. Train Test Split
  13. Linear Regression
  14. Logistic Regression
  15. Decision Trees
  16. Random Forests
  17. Support Vector Machines
  18. K Nearest Neighbors
  19. Naive Bayes Classifier
  20. Clustering With K Means
  21. Dimensionality Reduction
  22. Principal Component Analysis
  23. Model Evaluation Metrics
  24. Cross Validation
  25. Hyperparameter Tuning
  26. Overfitting And Underfitting
  27. Neural Networks Basics
  28. Deep Learning Vs Machine Learning
  29. Intro To TensorFlow And Keras
  30. Building Your First Ml Model
  31. Machine Learning Best Practices

Use a Python virtual environment and scikit-learn for your first machine learning setup. Verify the installation with a tiny synthetic dataset before downloading a large one.

What you need

  • Python, a terminal and editor
  • A virtual environment
  • scikit-learn and its installed dependencies

Set up your environment

  1. Install Python 3.12 for a conservative starting point, then create a practice folder. Check the current scikit-learn requirements if selecting another Python version.
  2. Run python -m venv .venv. The commands below use the Windows virtual-environment interpreter directly, so activation is optional.
  3. Run .venv\Scripts\python.exe -m pip install --upgrade pip, then .venv\Scripts\python.exe -m pip install scikit-learn.
  4. Save the example as check_ml.py. On Linux/macOS replace the interpreter path with .venv/bin/python.

Your first check

Save as check_ml.py

from sklearn.linear_model import LinearRegression

model = LinearRegression().fit([[1], [2], [3]], [2, 4, 6])
prediction = model.predict([[4]])
print(round(float(prediction[0]), 1))

Run or verify

.venv\Scripts\python.exe check_ml.py

Expected result: 8.0 is printed. This verifies the toolchain, not the usefulness of a real-world model.

Common setup problems

  • If sklearn cannot be imported, install scikit-learn with the same interpreter used to run the file.
  • Do not name your file sklearn.py or numpy.py; those names can shadow installed libraries.

Official documentation

Guide reviewed 17 November 2026. Check the linked vendor documentation for current supported versions and operating systems.