# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: lith_pred
#     language: python
#     name: lith_pred
# ---

# +
import numpy as np
import pandas as pd

import matplotlib.pyplot as plt

import seaborn as sns

from src.definitions import ROOT_DIR
from src.visualization.visualize import plot_ecdf
# -

# %load_ext autoreload
# %autoreload 2

plt.style.use('seaborn-poster')

# # Load train data

# +
train_path = ROOT_DIR / 'data/external' / 'CSV_train.csv'

assert train_path.is_file()
# -

data = pd.read_csv(train_path, sep=';')

data.sample(10)

data.shape

# ## Raw features

data.columns

# # GR distribution per well

# +
fig, ax = plt.subplots(1, 1, figsize=(15, 10))

sns.kdeplot(data=data,
            x='GR',
            hue='WELL',
            common_norm=True,
            fill=False,
            legend=False,
            ax=ax)

plt.title('All GR distribution')

plt.show()
# -

plot_ecdf(data['GR'], 'GR', quantiles=[0.05, 0.95])

sns.displot(data=data, x='GR', kind='ecdf')

data['GROUP'].value_counts(normalize=True, dropna=False)

# +
cond = data['GROUP'] == 'HORDALAND GP.'

df = data.loc[cond, :]
# -

df

df.groupby('WELL')['GR'].count()['31/2-19 S']



low_gr, high_gr = 24, 127

# +
fig, ax = plt.subplots(1, 1, figsize=(15, 50))

sns.violinplot(data=df,
               x='GR',
               y='WELL',
               common_norm=False,
               scale="width",
               fill=False,
               legend=False,
               linewidth=0.5,
               ax=ax)

plt.axvline(x=low_gr)
plt.axvline(x=high_gr)


plt.title('All GR distributions')

plt.show()

StarcoderdataJupyterScriptsDedupFiltered