<jupyter_start><jupyter_text><jupyter_code>import h5py as h5
import tensorflow as tf
import numpy as np
import pandas as pd
# Create new model instances
new_model_1 = tf.keras.models.load_model('/content/drive/MyDrive/saved_model/my_model1')
new_model_2 = tf.keras.models.load_model('/content/drive/MyDrive/saved_model/my_model1')
new_model_3 = tf.keras.models.load_model('/content/drive/MyDrive/saved_model/my_model1')
global_model = tf.keras.models.load_model('/content/drive/MyDrive/saved_model/my_model1')
new_model_1.load_weights("/content/drive/MyDrive/weights1.h5")
new_model_2.load_weights("/content/drive/MyDrive/weights2.h5")
new_model_3.load_weights("/content/drive/MyDrive/dpappliedweights1now.h5")
global_model.load_weights("/content/drive/MyDrive/global_weights.h5")
from sklearn.ensemble import VotingClassifier

ens1 = VotingClassifier(estimators= [('LM1',new_model_1),('GM',global_model)], voting = 'hard')
ens2 = VotingClassifier(estimators= [('LM2',new_model_2),('GM',global_model)], voting = 'hard')
ens_all = VotingClassifier(estimators= [('LM1',new_model_1),('LM2',new_model_2),('GM',global_model)], voting = 'hard')

ens1.fit(X1_train, Y1_train)
ens2.fit(X2_train, Y2_train)
ens_all.fit(X1_train, Y1_train)
# Check its architecture
new_model_1.summary()
df1 = pd.read_csv('/content/drive/MyDrive/diabetes.csv')
# Convert dataframe to numpy array
dataset1 = df1.values
# split into input (X) and an output (Y)
X1= dataset1[:,0:8]
Y1 = dataset1[:, 8].astype(int)

# Importing the dataset
dataset2 = pd.read_csv('/content/drive/MyDrive/Datasets/Diabetes Dataset/diabetes1.csv')
X2 = dataset2.iloc[:, :-1].values
Y2 = dataset2.iloc[:, -1].values

# Feature Scaling
from sklearn.preprocessing import StandardScaler
sc1 = StandardScaler()
sc2 = StandardScaler()
X1 = sc1.fit_transform(X1)
X2 = sc2.fit_transform(X2)

from sklearn.model_selection import train_test_split
X1_train, X1_test, Y1_train, Y1_test = train_test_split(X1, Y1, test_size=0.20, random_state=0)
X2_train, X2_test, Y2_train, Y2_test = train_test_split(X2, Y2, test_size=0.20, random_state=0)
new_model_1.evaluate(X1_test,Y1_test)


new_model_2.evaluate(X2_test,Y2_test)
global_model.evaluate(X1_test,Y1_test)
global_model.evaluate(X2_test,Y2_test)
new_model_3.evaluate(X1_test,Y1_test)
new_model_3.evaluate(X2_test,Y2_test)
Accuracy = ens1.score(X1_test, Y1_test)
print(Accuracy*100)
Accuracy = ens2.score(X2_test, Y2_test)
print(Accuracy*100)
Accuracy = ens_all.score(X1_test, Y1_test)
print(Accuracy*100)
ens_all.fit(X2_train, Y2_train)

Accuracy = ens_all.score(X2_test, Y2_test)
print(Accuracy*100)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13516609392898052, 'fraction_numerical': 0.047346315387552504, 'mean_word_length': 7.9419795221843, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '484874', 'license': 'MIT', 'n_tokens_mistral': 1090, 'n_tokens_neox': 1048, 'n_words': 153, 'path': 'Testing.ipynb', 'repo_name': 'Rishabhc711/Federated_in_Healthcare', 'size': '2619'}