Kaggle competition: Tabular Playground Series - Feb 2021
<SOS> metric: RMSE Kaggle data source: tabular-playground-series-feb-2021<import_modules>
system('pip install pycaret');
print("Tensorflow version " + tf.__version__)
 AUTO = tf.data.experimental.AUTOTUNE
if not colab: 
<define_variables>
import pandas as pd
from pycaret.regression import *
def seed_everything(seed):
random.seed(seed)
 np.random.seed(seed)
 os.environ['PYTHONHASHSEED'] = str(seed)
 tf.random.set_seed(seed )<load_from_csv>
train = pd.read_csv('.. /input/tabular-playground-series-feb-2021/train.csv', index_col='id')
 test = pd.read_csv('.. /input/tabular-playground-series-feb-2021/test.csv', index_col='id' )
NAME='EffNB3_512'
NFOLDS=5
NBEST=2
SEED=311
if colab:
PATH=Path('/content/gdrive/My Drive/kaggle/input/siim-isic-melanoma-classification/')
 train=pd.read_csv(PATH/'train.csv.zip')
 else:
PATH=Path('/kaggle/input/siim-isic-melanoma-classification/')
 train=pd.read_csv(PATH/'train.csv')
 test=pd.read_csv(PATH/'test.csv')
 sub=pd.read_csv(PATH/'sample_submission.csv')
 seed_everything(SEED )<set_options>
setup(data=train,
target='target',
fold=4,
silent=True,
verbose=False,
session_id=2021);
try:
tpu = tf.distribute.cluster_resolver.TPUClusterResolver()
print('Running on TPU ', tpu.master())
 except ValueError:
tpu = None
if tpu:
tf.config.experimental_connect_to_cluster(tpu)
 tf.tpu.experimental.initialize_tpu_system(tpu)
 strategy = tf.distribute.experimental.TPUStrategy(tpu)
 else:
strategy = tf.distribute.get_strategy()
print("REPLICAS: ", strategy.num_replicas_in_sync )<install_modules>
model = create_model('lightgbm' )
GCS_PATH = KaggleDatasets().get_gcs_path('siim-isic-melanoma-classification')
 print(GCS_PATH)
 !gsutil ls $GCS_PATH<define_variables>
tuned_model = tune_model(model,
custom_grid=None,
optimize='RMSE',
search_library='scikit-optimize',
n_iter=400,
choose_better=True )
GCS_PATH={}
if colab:
GCS_PATH['train']='gs://kds-8d3ddd90d7523c7ce02205a8ca8dd2d6c1fde5e071c72f852587566c'
GCS_PATH['test']='gs://kds-6c0f251418566e5596a0ab88ef637925c8f18c05edd525d1d741a07f'
else:
GCS_PATH['train']=KaggleDatasets().get_gcs_path('siim-512x512-tfrec-q95')
 GCS_PATH['test']=KaggleDatasets().get_gcs_path('siim-512x512-tfrec-q95-test')
 print(GCS_PATH['train'])
 print(GCS_PATH['test'] )<define_variables>
final_model = finalize_model(tuned_model )
<feature_engineering><EOS> 
prediction = predict_model(final_model, test)
 prediction['Label'].rename('target' ).to_csv('submission.csv' )