-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #214 from priyansh985/main
enhancement Add Optimization Techniques with Intel Specific Optimization in Intel_Optimization.md
- Loading branch information
Showing
7 changed files
with
163 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a single version of Python | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||
|
||
name: Python application | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 pytest | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Test with pytest | ||
run: | | ||
pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# Optimization with Intel oneAPI AI Analytics Toolkit | ||
|
||
## 📝 **Overview** | ||
|
||
This repository's stock price prediction model has been optimized using Intel's oneAPI AI Analytics Toolkit, specifically leveraging: | ||
- **Intel Distribution for scikit-learn** | ||
- **Modin Distribution for parallelized Pandas operations** | ||
- **Intel oneDAAL library for accelerated machine learning algorithms** | ||
|
||
## 🚀 **Key Optimizations** | ||
|
||
### **Intel scikit-learn Distribution** | ||
|
||
Utilized optimized algorithms for: | ||
- **Linear Regression** | ||
- **Decision Trees** | ||
- **Random Forest** | ||
|
||
![Intel scikit-learn vs Normal scikit-learn](./images/scikit-learn-acceleration.png) | ||
|
||
### **Modin Distribution** | ||
|
||
Parallelized Pandas operations for: | ||
- **Data loading and preprocessing** | ||
- **Data transformation and feature engineering** | ||
|
||
![Pandas vs Modin](./images/modin-and-pandas-performance.png) | ||
|
||
### **Intel oneDAAL Library** | ||
|
||
Accelerated machine learning algorithms for: | ||
- **Principal Component Analysis (PCA)** | ||
- **K-Means Clustering** | ||
- **Linear Regression** | ||
|
||
## 🎯 **Benefits** | ||
|
||
- **Improved Performance**: Up to **[30 and more]%** reduction in training/inference time. | ||
- **Enhanced Scalability**: Efficiently handle large datasets and complex models. | ||
- **Increased Accuracy**: Optimized algorithms for improved prediction accuracy. | ||
|
||
## 📋 **Requirements** | ||
|
||
- **Intel oneAPI AI Analytics Toolkit installed** | ||
- **Compatible Intel hardware** (e.g., Intel Core processors, Intel Xeon Scalable processors) | ||
|
||
## 🛠️ **Usage** | ||
|
||
1. **Clone the repository.** | ||
2. **Install [Intel oneAPI AI Analytics Toolkit](https://github.com/intel/aikit-operator).** | ||
3. **Install [Intel Distribution for scikit-learn](https://intel.github.io/scikit-learn-intelex/) and [Modin](https://modin.readthedocs.io/en/latest/).** | ||
4. **Build and run the optimized model using the provided instructions.** | ||
5. **Alternatively, you can install individual components using pip:** | ||
```bash | ||
pip install scikit-learn-intelex | ||
pip install modin[all] | ||
``` | ||
|
||
## 💻 **Code Snippets** | ||
```python | ||
# Import necessary libraries | ||
from sklearnex import patch_sklearn | ||
import modin.pandas as pd | ||
from daal4py import PCA | ||
# Patch scikit-learn to use Intel optimizations | ||
patch_sklearn() | ||
# Example: Load data using Modin | ||
df = pd.read_csv('stock_prices.csv') | ||
# Example: Preprocess data | ||
df['Date'] = pd.to_datetime(df['Date']) | ||
df.set_index('Date', inplace=True) | ||
# Example: Train a Linear Regression model using Intel optimized scikit-learn | ||
from sklearn.linear_model import LinearRegression | ||
X = df[['Open', 'High', 'Low', 'Volume']] | ||
y = df['Close'] | ||
model = LinearRegression() | ||
model.fit(X, y) | ||
# Example: Perform PCA using Intel oneDAAL | ||
pca = PCA(n_components=2) | ||
pca_result = pca.fit_transform(X) | ||
print("PCA Result:", pca_result) | ||
``` | ||
|
||
### **Python** |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters