priceprophet 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- priceprophet-0.1.0/PKG-INFO +11 -0
- priceprophet-0.1.0/README.md +18 -0
- priceprophet-0.1.0/setup.cfg +4 -0
- priceprophet-0.1.0/setup.py +15 -0
- priceprophet-0.1.0/src/priceprophet/__init__.py +7 -0
- priceprophet-0.1.0/src/priceprophet/forecaster.py +56 -0
- priceprophet-0.1.0/src/priceprophet.egg-info/PKG-INFO +11 -0
- priceprophet-0.1.0/src/priceprophet.egg-info/SOURCES.txt +9 -0
- priceprophet-0.1.0/src/priceprophet.egg-info/dependency_links.txt +1 -0
- priceprophet-0.1.0/src/priceprophet.egg-info/requires.txt +3 -0
- priceprophet-0.1.0/src/priceprophet.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: priceprophet
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Time-Series Forecasting for Prices
|
|
5
|
+
Requires-Python: >=3.8
|
|
6
|
+
Requires-Dist: pandas
|
|
7
|
+
Requires-Dist: numpy
|
|
8
|
+
Requires-Dist: scikit-learn
|
|
9
|
+
Dynamic: requires-dist
|
|
10
|
+
Dynamic: requires-python
|
|
11
|
+
Dynamic: summary
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# PriceProphet: Time-Series Forecasting
|
|
2
|
+
|
|
3
|
+
Predict future prices with ease.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
```bash
|
|
7
|
+
pip install priceprophet
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
- **Forecaster**: Easy-to-use forecasting engine built on scikit-learn.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
```python
|
|
15
|
+
from priceprophet import Forecaster
|
|
16
|
+
f = Forecaster()
|
|
17
|
+
# future = f.fit_predict(df, 'date', 'price')
|
|
18
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="priceprophet",
|
|
5
|
+
version="0.1.0",
|
|
6
|
+
description="Time-Series Forecasting for Prices",
|
|
7
|
+
package_dir={"": "src"},
|
|
8
|
+
packages=find_packages(where="src"),
|
|
9
|
+
install_requires=[
|
|
10
|
+
"pandas",
|
|
11
|
+
"numpy",
|
|
12
|
+
"scikit-learn",
|
|
13
|
+
],
|
|
14
|
+
python_requires=">=3.8",
|
|
15
|
+
)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
import numpy as np
|
|
3
|
+
from sklearn.linear_model import LinearRegression
|
|
4
|
+
from typing import Optional, List, Dict
|
|
5
|
+
|
|
6
|
+
class Forecaster:
|
|
7
|
+
"""
|
|
8
|
+
Simple time-series forecasting.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
def __init__(self):
|
|
12
|
+
self.model = LinearRegression()
|
|
13
|
+
|
|
14
|
+
def fit_predict(self, df: pd.DataFrame, date_col: str, value_col: str, periods: int = 30) -> pd.DataFrame:
|
|
15
|
+
"""
|
|
16
|
+
Train on data and predict future prices.
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
df: Historical data
|
|
20
|
+
date_col: Name of date column
|
|
21
|
+
value_col: Name of price/value column
|
|
22
|
+
periods: Days to predict
|
|
23
|
+
|
|
24
|
+
Returns:
|
|
25
|
+
DataFrame with 'Date', 'Predicted_Value', 'Lower_Bound', 'Upper_Bound'
|
|
26
|
+
"""
|
|
27
|
+
df = df.copy()
|
|
28
|
+
df[date_col] = pd.to_datetime(df[date_col])
|
|
29
|
+
df = df.sort_values(date_col)
|
|
30
|
+
|
|
31
|
+
# Prepare features (convert dates to ordinal)
|
|
32
|
+
df['ordinal'] = df[date_col].map(pd.Timestamp.toordinal)
|
|
33
|
+
X = df[['ordinal']]
|
|
34
|
+
y = df[value_col]
|
|
35
|
+
|
|
36
|
+
# Fit
|
|
37
|
+
self.model.fit(X, y)
|
|
38
|
+
|
|
39
|
+
# Future dates
|
|
40
|
+
last_date = df[date_col].max()
|
|
41
|
+
future_dates = pd.date_range(start=last_date + pd.Timedelta(days=1), periods=periods)
|
|
42
|
+
future_ordinal = future_dates.map(pd.Timestamp.toordinal).values.reshape(-1, 1)
|
|
43
|
+
|
|
44
|
+
# Predict
|
|
45
|
+
predictions = self.model.predict(future_ordinal)
|
|
46
|
+
|
|
47
|
+
# Result
|
|
48
|
+
future_df = pd.DataFrame({
|
|
49
|
+
'Date': future_dates,
|
|
50
|
+
'Predicted_Value': predictions,
|
|
51
|
+
# Dummy confidence interval (fixed +/- 5% spread around prediction)
|
|
52
|
+
'Lower_Bound': predictions * 0.95,
|
|
53
|
+
'Upper_Bound': predictions * 1.05
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
return future_df
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: priceprophet
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Time-Series Forecasting for Prices
|
|
5
|
+
Requires-Python: >=3.8
|
|
6
|
+
Requires-Dist: pandas
|
|
7
|
+
Requires-Dist: numpy
|
|
8
|
+
Requires-Dist: scikit-learn
|
|
9
|
+
Dynamic: requires-dist
|
|
10
|
+
Dynamic: requires-python
|
|
11
|
+
Dynamic: summary
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
setup.py
|
|
3
|
+
src/priceprophet/__init__.py
|
|
4
|
+
src/priceprophet/forecaster.py
|
|
5
|
+
src/priceprophet.egg-info/PKG-INFO
|
|
6
|
+
src/priceprophet.egg-info/SOURCES.txt
|
|
7
|
+
src/priceprophet.egg-info/dependency_links.txt
|
|
8
|
+
src/priceprophet.egg-info/requires.txt
|
|
9
|
+
src/priceprophet.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
priceprophet
|