This file contains hidden or 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
import cudf | |
import cuml | |
import pyfolio as pf | |
import numpy as np | |
import pandas as pd | |
import yfinance as yf | |
import matplotlib.pyplot as plt | |
from hmmlearn import hmm | |
from sklearn.utils import check_random_state |
This file contains hidden or 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
# Import the libraries | |
import pandas as pd | |
import cudf | |
import cuml | |
from cuml.datasets import make_classification | |
from cuml.model_selection import train_test_split | |
# Generating a sample Pandas DataFrame | |
X, y = make_classification(n_samples=1000, n_features=4, n_classes=2, random_state=42) |
This file contains hidden or 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
# Import the libraries | |
from cuml.cluster import KMeans | |
import cudf | |
# Generate sample data | |
data = cudf.DataFrame() | |
data['feature1'] = cp.random.rand(1000) | |
data['feature2'] = cp.random.rand(1000) | |
# Perform KMeans clustering |
This file contains hidden or 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
# Import the libraries | |
import pandas as pd | |
import cudf | |
# Creating a Pandas DataFrame | |
pandas_data = { | |
'A': [1, 2, 3, 4, 5], | |
'B': [10, 20, 30, 40, 50], | |
'C': ['a', 'b', 'c', 'd', 'e'] | |
} |
This file contains hidden or 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
# Import the corresponding library | |
import cudf | |
# Create a GPU DataFrame | |
data = {'A': [1, 2, 3], 'B': [4, 5, 6]} | |
df = cudf.DataFrame(data) | |
# Perform data manipulation | |
df['C'] = df['A'] + df['B'] | |
print(df) |
This file contains hidden or 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
# Import the corresponding library | |
import cupy as cp | |
# Define matrices using CuPy arrays | |
matrix_a = cp.array([[1, 2], [3, 4]]) | |
matrix_b = cp.array([[5, 6], [7, 8]]) | |
# Perform a matrix multiplication using CuPy | |
result = cp.matmul(matrix_a, matrix_b) | |
print("Result of Matrix Multiplication:") |
This file contains hidden or 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
# Import the cupy library | |
import cupy as cp | |
# Create 10,000 random numbers | |
x = cp.random.rand(10000) | |
y = cp.random.rand(10000) | |
# Perform the multiplication of both arrays | |
result = cp.dot(x, y) |
This file contains hidden or 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
import cudf | |
import cuml | |
import cupy |
This file contains hidden or 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
conda install -c rapidsai -c nvidia -c conda-forge -c defaults rapids=0.21 python=3.10 |
This file contains hidden or 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
conda activate rapids |