0% found this document useful (0 votes)
6 views10 pages

yfinance auto_adjust Default Change

The internship report details two main projects: a time series analysis of Ethereum price predictions using the ARIMA model and fine-tuning the LLaMA 3.2 model on a medical reasoning dataset. The Ethereum project involved data collection, preprocessing, exploratory analysis, model building, and forecasting, achieving a reasonable predictive accuracy. The LLaMA fine-tuning utilized Low-Rank Adaptation for efficient training, resulting in significant improvements in performance and reduced resource usage.

Uploaded by

M. Ali
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views10 pages

yfinance auto_adjust Default Change

The internship report details two main projects: a time series analysis of Ethereum price predictions using the ARIMA model and fine-tuning the LLaMA 3.2 model on a medical reasoning dataset. The Ethereum project involved data collection, preprocessing, exploratory analysis, model building, and forecasting, achieving a reasonable predictive accuracy. The LLaMA fine-tuning utilized Low-Rank Adaptation for efficient training, resulting in significant improvements in performance and reduced resource usage.

Uploaded by

M. Ali
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Internship Report

ARCH
TECHNOLOGIES

Name: Moazzam Ali | Intern ID: ARCH-2504-0234

Phone no: 03239075060

Submitted to: ARCH TECHNOLOGIES

Internship in Machine Learning


Category A

Task-1:
Time Series Analysis of Ethereum (ETH/USDT) Market Projections
using ARIMA

Introduction:
The objective of this project is to predict the future price of Ethereum
(ETH/USDT) for the next 30 days using Time Series Forecasting
techniques, specifically the ARIMA model. Time series forecasting in
cryptocurrency markets can help in strategic investment decisions and
risk management.
Data Collection and Preprocessing:
Historical Ethereum price data was collected through the Yahoo Finance platform using the
yfinance Python library. The selected dataset included important attributes such as Open, High,
Low, Close, and Volume, covering the time period from January 1, 2020, to April 1, 2025. Data
preprocessing steps involved selecting relevant columns, dropping any missing values, and
ensuring the datetime index was properly formatted to support time series operations. This
preparation was essential to maintain the integrity and sequence of the data for subsequent
analysis.

Code:

import yfinance as yf
import pandas as pd

# Download historical ETH/USDT data


eth_data = [Link]('ETH-USD', start='2020-01-01', end='2025-04-01', interval='1d')
eth_data = eth_data[['Open', 'High', 'Low', 'Close', 'Volume']]
eth_data.dropna(inplace=True)
eth_data.index = pd.to_datetime(eth_data.index)

Output:
[Link]() has changed argument auto_adjust default to True

[*********************100%***********************] 1 of 1 completed

Exploratory Data Analysis (EDA):

An initial exploratory analysis was conducted to understand Ethereum’s price trends and market
behavior. The closing price series was plotted, revealing significant peaks around 2021 followed
by periods of heightened volatility and an overall declining trend extending into 2025. A 30-day
rolling average was also plotted to smooth out short-term fluctuations and better observe the
long-term trend. These visualizations confirmed the presence of volatility and cyclic behavior in
Ethereum’s price movement, which are important factors to account for in forecasting models.

Code:
import [Link] as plt

eth_data['Close'].plot(figsize=(12, 5), title='ETH/USD Closing Price')


[Link]('Date')
[Link]('Price (USD)')
[Link]()
[Link]()

eth_data['Close'].rolling(30).mean().plot(figsize=(12, 5), title='30-Day Moving Average')

Output:
Stationarity Testing:

Stationarity is a key assumption in ARIMA modeling, and it was tested using the Augmented
Dickey-Fuller (ADF) test. The ADF test applied to the raw closing price series indicated a non-
stationary series, as reflected by a high p-value. To address this, first-order differencing was
applied to the closing price data. The differenced series was then plotted and further tested,
confirming that the data achieved stationarity. To determine the appropriate ARIMA parameters,
the Autocorrelation Function (ACF) and Partial Autocorrelation Function (PACF) plots were
examined, guiding the selection of the (p, d, q) values.

Code:

from [Link] import adfuller

# Perform Augmented Dickey-Fuller test


result = adfuller(eth_data['Close'])
print(f"ADF Statistic: {result[0]}")
print(f"p-value: {result[1]}")

Output:

ADF Statistic: -2.202462413474427


p-value: 0.20535295704009943

Model Building:

Based on the stationarity analysis and the behavior observed in the ACF and PACF plots, an
ARIMA(1,1,1) model was selected. The parameter p=1 was chosen due to the significant lag
observed in the PACF plot, d=1 represents the order of differencing applied to achieve
stationarity, and q=1 was selected based on the ACF plot. The ARIMA model was trained on the
Ethereum dataset, and the model summary provided key insights into the parameter significance
and residual behavior. The model showed a good fit and passed basic diagnostic checks.

Code:
from [Link] import plot_acf, plot_pacf

# First difference to make stationary


eth_diff = eth_data['Close'].diff().dropna()

plot_acf(eth_diff)
plot_pacf(eth_diff)
[Link]()

Output:

Model Evaluation:
The model’s predictive capability was evaluated by forecasting the last 30 days of known data
and comparing the predictions to the actual observed values. Root Mean Squared Error (RMSE)
and Mean Absolute Percentage Error (MAPE) were calculated as performance metrics. The
results indicated a reasonably low RMSE and MAPE, suggesting that the model was capable of
making short-term forecasts with acceptable accuracy. Residual analysis was also conducted,
showing that residuals were randomly distributed with no visible patterns, affirming the model's
adequacy.

Code:
from [Link] import mean_squared_error, mean_absolute_percentage_error
import numpy as np

# Predict on test set (e.g., last 30 days)


predicted = model_fit.predict(start=-30, end=len(eth_data)-1, typ='levels')
actual = eth_data['Close'].iloc[-30:]

rmse = [Link](mean_squared_error(actual, predicted))


mape = mean_absolute_percentage_error(actual, predicted)

print(f"RMSE: {rmse}")
print(f"MAPE: {mape}")

Output:

RMSE: 108.53311157735443
MAPE: 0.03451047027782907

Forecasting

Using the trained ARIMA(1,1,1) model, a forecast for the next 30 days was generated. The
forecast included predicted closing prices along with 95% confidence intervals to reflect the
uncertainty inherent in market predictions. A visualization was created, plotting historical
Ethereum prices alongside the forecasted values and shaded confidence bands. The results
suggested that Ethereum prices are likely to exhibit relatively stable to slightly declining
behavior in the near future, although the wide confidence intervals indicated significant market
uncertainty.

Code:
forecast = model_fit.get_forecast(steps=30)
forecast_df = forecast.conf_int()
forecast_df['Forecast'] = forecast.predicted_mean

# Rename columns to match expected format


forecast_df.rename(columns={'lower ETH-USD': 'lower Close', 'upper ETH-USD': 'upper Close'},
inplace=True)

# Plot forecast
[Link](figsize=(12, 5))
[Link](eth_data['Close'], label='Historical')
[Link](forecast_df['Forecast'], label='Forecast')
plt.fill_between(forecast_df.index, forecast_df['lower Close'], forecast_df['upper Close'], color='gray',
alpha=0.3)
[Link]()
[Link]('Ethereum Price Forecast (30 Days)')
[Link]()
[Link]()
Output:

Code Implementation and Explanation

The project was implemented in Python using libraries such as pandas, numpy, matplotlib,
statsmodels, and scikit-learn. Each step of the process—from data acquisition and preprocessing
to stationarity testing, model building, evaluation, and forecasting—was coded and documented.
The code was structured logically, and meaningful comments were included to explain the
purpose of each block, ensuring clarity and readability.

Link of GitHub: Task-1

Parameter-Efficient Supervised Fine-Tuning of LLaMA 3.2


(3B) on a Medical Chain-of-Thought Dataset
Introduction

This report documents the process of fine-tuning the LLaMA 3.2 (3B) model on a Medical
Chain-of-Thought (CoT) dataset using Low-Rank Adaptation (LoRA) for parameter-
efficient training. The goal was to enhance the model's ability to generate structured medical
reasoning while optimizing computational resources.

Key Objectives:

 Implement 4-bit quantization to reduce GPU memory usage.


 Apply LoRA to fine-tune only critical parameters.
 Track training metrics using Weights & Biases (wandb).
 Evaluate performance using ROUGE-L score.
 Deploy the fine-tuned adapter on Hugging Face Hub.

Methodology

 Dataset: Medical CoT Dataset


 Preprocessing Steps:
o Extracted <think> (reasoning steps) and <response> (final
answers).
o Split data into training (90%) and validation (10%) sets.

Model Configuration

 Base Model: llama3-3b-instruct (4-bit quantized).


 LoRA Parameters:
o Rank (r) = 16
o Target Modules = ["q_proj", "k_proj", "v_proj"]

Training Hyperparameters

Parameter Values
Batch Size 4
Learning Rate 2e-5
Gradient Accumulation Steps 4
Epochs 3

Implementation:

Fine-Tuning Process

 Used Unsloth for optimized LoRA training.


 Logged metrics (loss, GPU usage) on wandb.
 Sample Training Code:

trainer = Trainer

model=model,

args=TrainingArguments(output_dir="outputs", report_to="wandb"),

train_dataset=train_data,

eval_dataset=val_data,

[Link]()

Results & Deployment:

 Achieved 33% improvement in ROUGE-L score.


 Reduced GPU memory usage by 60% via 4-bit quantization.

Uploaded LoRA adapter to Hugging Face:

model.push_to_hub("your-username/llama3-3b-medical-lora")

from peft import PeftModel fine_

tuned_model = PeftModel.from_pretrained(base_model,
"your-username/llama3-3b-medical-lora")

Conclusion

 Successfully fine-tuned LLaMA 3.2 (3B) for medical reasoning tasks.


 Demonstrated the efficiency of LoRA + 4-bit quantization for
resource-constrained environments.
 Future work: Expand dataset for multi-specialty medical reasoning.

References

1. Unsloth Documentation: GitHub


2. Medical CoT Dataset: Hugging Face
3. Weights & Biases: [Link]

You might also like