<jupyter_start><jupyter_text>Predicting employee attrition rate in organizations  Using PyCaret  Step 1: Importing the data<jupyter_code>import numpy as np
import pandas as pd
from pycaret.regression import *
train_csv = '../dataset/Train.csv'
test_csv = '../dataset/Test.csv'
train_data = pd.read_csv(train_csv)
test_data = pd.read_csv(test_csv)<jupyter_output><empty_output><jupyter_text>Step 2: Setup<jupyter_code>reg = setup(train_data, target='Attrition_rate', ignore_features=['Employee_ID'])<jupyter_output>Setup Succesfully Completed!<jupyter_text>Step 3: Tuning the models<jupyter_code>compare_models()<jupyter_output><empty_output><jupyter_text>Step 4: Selecting a model<jupyter_code>model = create_model('br')
print(model)<jupyter_output>BayesianRidge(alpha_1=1e-06, alpha_2=1e-06, alpha_init=None,
              compute_score=False, copy_X=True, fit_intercept=True,
              lambda_1=1e-06, lambda_2=1e-06, lambda_init=None, n_iter=300,
              normalize=False, tol=0.001, verbose=False)<jupyter_text>Step 5: Predicting on test data<jupyter_code>predictions = predict_model(model, data = test_data)
predictions
predictions.rename(columns={"Label": "Attrition_rate"}, inplace=True)
predictions[['Employee_ID', 'Attrition_rate']].to_csv('../predictions.csv', index=False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12254160363086233, 'fraction_numerical': 0.02118003025718608, 'mean_word_length': 7.703947368421052, 'pattern_counts': {'":': 1, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '627', 'license': 'MIT', 'n_tokens_mistral': 497, 'n_tokens_neox': 474, 'n_words': 75, 'path': 'notebooks/.ipynb_checkpoints/pycaret-final-checkpoint.ipynb', 'repo_name': 'ChandrakanthNethi/predict-the-employee-attrition-rate-in-organizations', 'size': '1322'}