<jupyter_start><jupyter_text>Importing the libraries<jupyter_code>import numpy as np
import pandas as pd
import tensorflow as tf<jupyter_output><empty_output><jupyter_text>Importing the dataset<jupyter_code>dataset = pd.read_excel('Folds5x2_pp.xlsx')
X = dataset.iloc[:, :-1].values
y = dataset.iloc[:, -1].values
dataset.head()<jupyter_output><empty_output><jupyter_text>Splitting the dataset into the Training set and Test set<jupyter_code>from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state = 0)<jupyter_output><empty_output><jupyter_text>Part 2 - Building the ANN  Initializing the ANN<jupyter_code>ann = tf.keras.models.Sequential()<jupyter_output><empty_output><jupyter_text>Adding the input layer and the first hidden layer<jupyter_code>ann.add(tf.keras.layers.Dense(units=6, activation='relu'))<jupyter_output><empty_output><jupyter_text>Adding the second hidden layer<jupyter_code>ann.add(tf.keras.layers.Dense(units=6, activation='relu'))<jupyter_output><empty_output><jupyter_text>Adding the output layer<jupyter_code>ann.add(tf.keras.layers.Dense(units=1))<jupyter_output><empty_output><jupyter_text>Part 3 - Training the ANN  Compiling the ANN<jupyter_code>ann.compile(optimizer = 'adam', loss = 'mean_squared_error')<jupyter_output><empty_output><jupyter_text>Training the ANN model on the Training set<jupyter_code>ann.fit(X_train, y_train, batch_size = 32, epochs = 100)<jupyter_output>Epoch 1/100
240/240 [==============================] - 0s 905us/step - loss: 83933.8359
Epoch 2/100
240/240 [==============================] - 0s 812us/step - loss: 606.8795
Epoch 3/100
240/240 [==============================] - 0s 807us/step - loss: 480.7265
Epoch 4/100
240/240 [==============================] - 0s 844us/step - loss: 367.2324
Epoch 5/100
240/240 [==============================] - 0s 815us/step - loss: 269.6997
Epoch 6/100
240/240 [==============================] - 0s 870us/step - loss: 194.6647
Epoch 7/100
240/240 [==============================] - 0s 822us/step - loss: 141.6637
Epoch 8/100
240/240 [==============================] - 0s 825us/step - loss: 106.2143
Epoch 9/100
240/240 [==============================] - 0s 857us/step - loss: 80.4451
Epoch 10/100
240/240 [==============================] - 0s 786us/step - loss: 60.9646
Epoch 11/100
240/240 [==============================] - 0s 818us/step - loss: 47.7373
Epoch 12/100
240/240 [==============================][...]<jupyter_text>Predicting the results of the Test set<jupyter_code>y_pred = ann.predict(X_test)
np.set_printoptions(precision=2)
print(np.concatenate((y_pred.reshape(len(y_pred),1), y_test.reshape(len(y_test),1)),1))
from sklearn.metrics import r2_score
r2_score(y_test, y_pred)
from sklearn.ensemble import RandomForestRegressor
regressor = RandomForestRegressor(n_estimators = 10, random_state = 0)
regressor.fit(X_train, y_train)
y_pred = regressor.predict(X_test)
np.set_printoptions(precision=2)
print(np.concatenate((y_pred.reshape(len(y_pred),1), y_test.reshape(len(y_test),1)),1))
from sklearn.metrics import r2_score
r2_score(y_test, y_pred)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.22866141732283465, 'fraction_numerical': 0.08661417322834646, 'mean_word_length': 7.379947229551451, 'pattern_counts': {'":': 0, '<': 40, '<?xml version=': 0, '>': 40, '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': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '354456', 'license': 'Apache-2.0', 'n_tokens_mistral': 1376, 'n_tokens_neox': 1143, 'n_words': 211, 'path': '17.Artificial Neural Network/artificial_neural_network Regressor.ipynb', 'repo_name': 'Mahesh-Shirsath/Python-for-Machine-Learning', 'size': '3175'}