Skip to content
Tom Boyle edited this page Jul 3, 2024 · 3 revisions

Machine Learning Algorithms

This wiki contains detailed instructions, examples of usage, and additional resources for the machine learning algorithms implemented in this repository.

Table of Contents

  1. Supervised Learning
  2. Unsupervised Learning
  3. Reinforcement Learning
  4. Deep Learning
  5. Getting Started
  6. Contributing
  7. Further Resources
  8. Contact

Supervised Learning

Linear Regression

The Linear Regression example demonstrates how to:

  • Split data into training and testing sets.
  • Train a linear regression model.
  • Make predictions and evaluate the model's performance.

To run the example:

  1. Navigate to the SupervisedLearning directory:
    cd SupervisedLearning
  2. Run the LinearRegression.py script:
    python LinearRegression.py
  3. The script will display the Mean Squared Error (MSE) and the predictions made by the model.

Decision Tree

The Decision Tree example shows how to:

  • Split data into training and testing sets.
  • Train a decision tree model.
  • Make predictions and evaluate the model's performance.

To run the example:

  1. Navigate to the SupervisedLearning directory:
    cd SupervisedLearning
  2. Run the DecisionTree.py script:
    python DecisionTree.py
  3. The script will display the accuracy of the Decision Tree model and the predictions made.

Unsupervised Learning

K-Means Clustering

The K-Means Clustering example shows how to:

  • Create sample data points.
  • Apply the K-Means clustering algorithm.
  • Plot the resulting clusters.

To run the example:

  1. Navigate to the UnsupervisedLearning directory:
    cd UnsupervisedLearning
  2. Run the KMeansClustering.py script:
    python KMeansClustering.py
  3. The script will show a scatter plot with the clustered data points and centroids.

Principal Component Analysis (PCA)

The PCA example demonstrates how to:

  • Create sample data points.
  • Apply PCA to reduce dimensionality.
  • Plot the principal components.

To run the example:

  1. Navigate to the UnsupervisedLearning directory:
    cd UnsupervisedLearning
  2. Run the PCA.py script:
    python PCA.py
  3. The script will show a scatter plot of the principal components.

Reinforcement Learning

Q-Learning

The Q-Learning example demonstrates how to:

  • Initialize the gym environment.
  • Train the agent using the Q-Learning algorithm.
  • Evaluate the trained agent's performance.

To run the example:

  1. Navigate to the ReinforcementLearning directory:
    cd ReinforcementLearning
  2. Run the QLearning.py script:
    python QLearning.py
  3. The script will display the agent's performance after training.

Deep Q-Network (DQN)

The DQN example demonstrates how to:

  • Initialize the gym environment.
  • Train the agent using the DQN algorithm.
  • Evaluate the trained agent's performance.

To run the example:

  1. Navigate to the ReinforcementLearning directory:
    cd ReinforcementLearning
  2. Run the DQN.py script:
    python DQN.py
  3. The script will display the training progress and the agent's performance.

Deep Learning

Simple Neural Network

The Simple Neural Network example shows how to:

  • Load and preprocess the MNIST dataset.
  • Build and train a neural network.
  • Evaluate the model's performance.

To run the example:

  1. Navigate to the DeepLearning directory:
    cd DeepLearning
  2. Run the Neural_Network.py script:
    python Neural_Network.py
  3. The script will display the training accuracy and test accuracy of the neural network.

Convolutional Neural Network (CNN)

The CNN example demonstrates how to:

  • Load and preprocess the MNIST dataset.
  • Build and train a convolutional neural network.
  • Evaluate the model's performance.

To run the example:

  1. Navigate to the DeepLearning directory:
    cd DeepLearning
  2. Run the CNN.py script:
    python CNN.py
  3. The script will display the training accuracy and test accuracy of the convolutional neural network.

Getting Started

Prerequisites

Ensure you have Python installed on your machine. You can download it from python.org.

Installing Dependencies

To install the necessary libraries, you can use the provided requirements.txt file. Run the following command in your terminal:

pip install -r requirements.txt

Contributing

Feel free to fork this repository and submit pull requests. For major changes, please open an issue first to discuss what you would like to change. Contributions are welcome to add new algorithms, improve existing ones, or enhance documentation.

Further Resources

To learn more about the algorithms implemented in this repository, check out the following resources:

Contact

For any questions or issues, feel free to open an issue in this repository or contact me directly via X.