<jupyter_start><jupyter_text>Convert binary (Y/N) columns into numeric (1/0) 1. JOB_MATCH<jupyter_code>dataset['JOB_MATCH'].value_counts()
job_match = pd.get_dummies(dataset['JOB_MATCH'], drop_first=True)
job_match.columns = ['JOB_MATCH']
job_match['JOB_MATCH'].value_counts()<jupyter_output><empty_output><jupyter_text>2. S_GENDER<jupyter_code>dataset['S_GENDER'].value_counts()
# replace 'u' values with 'Female
dataset.loc[dataset['S_GENDER'] == 'u']
dataset.loc[dataset['S_GENDER'] == 'u', 'S_GENDER'] = 'Female'
# replaced
dataset.loc[dataset['S_GENDER'] == 'u']
dataset['S_GENDER'].value_counts()
gender = pd.get_dummies(dataset['S_GENDER'], drop_first=True)
gender.columns = ['GENDER']
gender['GENDER'].value_counts()<jupyter_output><empty_output><jupyter_text>3. S_EDUCATION<jupyter_code>dataset['S_EDUCATION'].value_counts()
# since this is not a binary classification, we wont drop first column
education = pd.get_dummies(dataset['S_EDUCATION'], drop_first=False)
education
# rename the columns to indicate in a better way
education.columns = ['EDU_HSE', 'EDU_PG', 'EDU_PRIM', 'EDU_UG']
education<jupyter_output><empty_output><jupyter_text>4. JOB_DESCRIPTION<jupyter_code>dataset['JOB_DESCRIPTION'].value_counts()
# since this is not a binary classification, we wont drop first column
job_desc = pd.get_dummies(dataset['JOB_DESCRIPTION'], drop_first=False)
job_desc
job_desc.columns = ['JOB_BPO', 'JOB_EXEC', 'JOB_MRKT', 'JOB_SECG', 'JOB_SUPM', 'JOB_TCHR']
job_desc<jupyter_output><empty_output><jupyter_text>5. J_LANGUAGE<jupyter_code>dataset['J_LANGUAGE'].value_counts()
# convert the language values to a single numeric column
lang = pd.get_dummies(dataset['J_LANGUAGE'], drop_first=True)
lang
lang.columns = ['LANGUAGE']
lang<jupyter_output><empty_output><jupyter_text>6. J_COMMUNICATION<jupyter_code>dataset['J_COMMUNICATION'].value_counts()
# convert the values to numeric
comm = pd.get_dummies(dataset['J_COMMUNICATION'], drop_first=True)
comm
comm.columns = ['COMMUNICATION']
comm<jupyter_output><empty_output><jupyter_text>7. J_PROB_SOLVE<jupyter_code>dataset['J_PROB_SOLVE'].value_counts()
# convert the values to numeric
prob = pd.get_dummies(dataset['J_PROB_SOLVE'], drop_first=True)
prob
prob.columns = ['PROB_SOLVE']
prob<jupyter_output><empty_output><jupyter_text>7. J_ATTEN_VIGIL<jupyter_code>dataset['J_ATTEN_VIGIL'].value_counts()
# convert the values to numeric
atten = pd.get_dummies(dataset['J_ATTEN_VIGIL'], drop_first=True)
atten
atten.columns = ['ATTEN_VIGIL']
atten<jupyter_output><empty_output><jupyter_text>8. J_ADAPT_INTERACT<jupyter_code>dataset['J_ADAPT_INTERACT'].value_counts()
# convert the values to numeric
adapt = pd.get_dummies(dataset['J_ADAPT_INTERACT'], drop_first=True)
adapt.columns = ['ADAPT_INTERACT']
adapt
# precautionary copy of dataset
dataset_copy = dataset.copy()
# drop object columns from dataset
dataset.drop(['JOB_MATCH', 'S_NAME', 'S_GENDER', 'S_EDUCATION', 'JOB_DESCRIPTION', 'J_LANGUAGE', 'J_COMMUNICATION', 'J_PROB_SOLVE', 'J_ATTEN_VIGIL', 'J_ADAPT_INTERACT'], axis=1, inplace=True)
dataset
# concat the nre derived columns
dataset_new = pd.concat([dataset, job_match, gender, education, job_desc, lang, comm, prob, atten, adapt], axis=1)
dataset_new.info()
dataset_new.head()
# dataset looks good to me overridden
dataset = dataset_new<jupyter_output><empty_output><jupyter_text>MODELING<jupyter_code># seperating the features from the response column (JOB_MATCH)
data_X = dataset.drop('JOB_MATCH', axis=1)
data_y = dataset['JOB_MATCH']
data_X.head()
data_y.head()<jupyter_output><empty_output><jupyter_text>Splitting the dataset into training and testing sets<jupyter_code># split the features and response using train_test_split
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(data_X, data_y, test_size=0.2, random_state=42)<jupyter_output><empty_output><jupyter_text>Training and Predicting 1. LogisticRegression<jupyter_code>from sklearn.linear_model import LogisticRegression
model_lr = LogisticRegression()
model_lr.fit(X_train, y_train)
# making predictions
predictions = model_lr.predict(X_test)
# evaluate the model
from sklearn.metrics import confusion_matrix
matrix = confusion_matrix(y_test, predictions)
matrix
# calculate accuracy score
from sklearn.metrics import accuracy_score
accuracy = accuracy_score(y_test, predictions)
accuracy
# calcuating additional evaluation parameters
from sklearn.metrics import classification_report
print(classification_report(y_test, predictions))<jupyter_output>precision    recall  f1-score   support

           0       0.92      0.89      0.90       325
           1       0.89      0.92      0.90       311

    accuracy                           0.90       636
   macro avg       0.90      0.90      0.90       636
weighted avg       0.90      0.90      0.90       636
{'fraction_non_alphanumeric': 0.11757425742574257, 'fraction_numerical': 0.015676567656765675, 'mean_word_length': 6.9361702127659575, 'pattern_counts': {'":': 0, '<': 48, '<?xml version=': 0, '>': 48, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '12', 'dir': 'jupyter-structured-clean-dedup', 'id': '473152', 'license': 'MIT', 'n_tokens_mistral': 1814, 'n_tokens_neox': 1740, 'n_words': 329, 'path': 'category_machine_learning/jobs_for_specially_abled/Code/eda_v3.ipynb', 'repo_name': 'Anshul-GH/upwork_projects', 'size': '4848'}