AllergenePrediction / backend /gettingFromModel.py
SyedSyab's picture
model added
d4a5429
raw
history blame contribute delete
960 Bytes
import datafit.datafit as df
def getResponse(data, model, LabelT, LabelS):
print(data.columns)
# Transform using the pre-trained LabelEncoder
data["Sequence"] = LabelS.transform(data["Sequence"])
# Apply normalization if needed
data, _ = df.normalization(data)
# Make predictions
response = model.predict(data)
# Assuming 'response' is a binary prediction (0 or 1)
# If it's a probability, you might need to adjust the logic accordingly
print("Raw Predictions:")
print(response)
# If you want to interpret the predictions directly (0 or 1)
predicted_labels = response.astype(int)
print("Predicted Labels:")
print(predicted_labels)
# If you want to use inverse_transform for better interpretation
# Uncomment the following lines
inverse_labels = LabelT.inverse_transform(predicted_labels)
print("Inverse Transformed Labels:")
print(inverse_labels)
return inverse_labels