# --------------------------------------------------
# Author      : E.Taskesen
# Contact     : erdogant@gmail.com
# github      : https://github.com/erdogant/distfit
# Licence     : MIT
# --------------------------------------------------

import numpy as np
import fitdist as fitdist
print(fitdist.__version__)


# %% Import class
from fitdist import fitdist
dir(fitdist)


#%%

X = np.random.normal(0, 2, 5000)
y = [-8,-6,0,1,2,3,4,5,6]

model = fitdist()
model.fit_transform(X)
model.plot()

# Make prediction
model.predict(y)
model.plot()


# %% Fit and transform
X = np.random.beta(5, 8, [100,100])
y = [-1,-0.8,-0.6,0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,1.1,1.5]

dist = fitdist()
dist.fit()
dist.transform(X)
dist.plot()
dist.predict(y)
dist.plot()

dist.plot_summary()

# %%  for Fit and transform in one go
X = np.random.beta(5, 8, [100,100])
y = [-1,-0.8,-0.6,0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1,1.1,1.5]

model = fitdist()
model.fit_transform(X)
model.plot()
model.predict(y)
model.plot()

model.plot_summary()

# %% Show some results
model.y_proba
model.y_pred
model.df



# %%
X = np.random.normal(0, 2, 1000)
y = [-8,-6,0,1,2,3,4,5,6]

model = dist(method='emperical')
model.fit_transform(X)
model.plot()

# Make prediction
model.predict(y)
model.plot()

# %%
X = np.random.normal(5, 8, [100,100])
y = [-35, -10, 0, 10, 15, 35]

model = fitdist()
model.fit_transform(X)
model.predict(y)
model.plot()

model = dist(method='emperical')
model.fit_transform(X)
model.predict(y)
model.plot()

model.y_proba
model.y_pred
model.df

# %%
X = np.random.beta(5, 8, 1000)

model = fitdist()
model.fit_transform(X)
model.plot()

# %% Find distribution parameters
X = np.random.normal(0, 2, 5000)
model = fitdist()
model.fit_transform(X)
model.plot()

X = np.random.normal(10, 1, 5000)
model = fitdist()
model.fit_transform(X)
model.plot()

X = np.random.normal(10, 5, 5000)
model = fitdist()
model.fit_transform(X)
model.plot()

# %%
X = np.random.normal(0, 2, 1000)
y = [-8,-6,0,1,2,3,4,5,6]

model = fitdist()
model.fit_transform(X)
model.predict(y)
model.plot()
model.df

model = dist(bound='up')
model.fit_transform(X)
model.predict(y)
model.plot()
model.df

model = dist(bound='down')
model.fit_transform(X)
model.predict(y)
model.plot()
model.df

# %% Find best fit distribution
X = np.random.normal(0, 2, 1000)
y = [-8,-6,0,1,2,3,4,5,6]

model = fitdist()
model.fit_transform(X)
model.plot()

model = dist(distribution='auto_small')
model.fit_transform(X)
model.plot()

model = dist(distribution='auto_full')
model.fit_transform(X)
model.plot()
