{"id":15159901,"url":"https://github.com/tushar365/simple-ann","last_synced_at":"2026-02-06T00:02:31.749Z","repository":{"id":254869804,"uuid":"847800805","full_name":"Tushar365/simple-ANN","owner":"Tushar365","description":"churn prediction : https://advance-bank-churn-prediction-365.streamlit.app/     salary prediction :     https://salary-prediction-365.streamlit.app/","archived":false,"fork":false,"pushed_at":"2024-08-30T07:12:00.000Z","size":423,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-14T16:02:41.769Z","etag":null,"topics":["ann","deep-learning","python","streamlit"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tushar365.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-26T15:14:03.000Z","updated_at":"2024-08-30T07:18:13.000Z","dependencies_parsed_at":"2024-11-03T08:41:15.689Z","dependency_job_id":"a8dc5cce-be85-4e04-a8fd-db6622b3e1ad","html_url":"https://github.com/Tushar365/simple-ANN","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"1d7b304713bcba6cc0539d4c612fd11db5e1f6d8"},"previous_names":["tushar365/simple-ann"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Tushar365/simple-ANN","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tushar365%2Fsimple-ANN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tushar365%2Fsimple-ANN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tushar365%2Fsimple-ANN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tushar365%2Fsimple-ANN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tushar365","download_url":"https://codeload.github.com/Tushar365/simple-ANN/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tushar365%2Fsimple-ANN/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265362255,"owners_count":23753112,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ann","deep-learning","python","streamlit"],"created_at":"2024-09-26T22:01:47.433Z","updated_at":"2026-02-06T00:02:31.715Z","avatar_url":"https://github.com/Tushar365.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simple-ANN\n\n1.Importing Libraries:\n\nimport streamlit as st\nimport numpy as np\nimport pandas as pd\nimport tensorflow as tf\nfrom sklearn.preprocessing import StandardScaler, LabelEncoder, OneHotEncoder\nimport pickle\nfrom tensorflow.keras.models import load_model\n\n\n'''\nstreamlit: A library for building interactive web apps in Python.\nnumpy, pandas: Standard libraries for numerical and data manipulation tasks.\ntensorflow: A popular deep learning library used to load and use the ANN model.\nsklearn.preprocessing: Modules to transform categorical data (LabelEncoder, OneHotEncoder) and scale numerical data (StandardScaler).\npickle: Used to load the pre-trained encoders and scaler.\n\n'''\n2. Loading the Pre-Trained Model and Encoders:\n\n# Load model\nmodel = load_model('annmodel.h5')\n\n# Load the pickle files\nwith open('label_encoder_gender.pkl', \"rb\") as file:\n    label_encoder_gender = pickle.load(file)\n\nwith open('one_hot_en.pkl', 'rb') as file:\n    one_hot_encoder_geo = pickle.load(file)\n\nwith open('scaler.pkl', 'rb') as file:\n    scaler = pickle.load(file)\n\n'''\nload_model('annmodel.h5'): Loads the pre-trained ANN model saved in an HDF5 file.\nPickle files: These files contain pre-fitted LabelEncoder, OneHotEncoder, and StandardScaler objects. \n            These are used to transform the input data in the same way as it was done during training.\n\n'''\n\n3.Building the Streamlit App:\n\nst.title('Customer Churn Prediction')\n#This sets the title of the web app.\n\n4. User Input Collection:\n\nCreditScore = st.number_input('Credit Score')\nGeography = st.selectbox('Geography', one_hot_encoder_geo.categories_[0])\nGender = st.selectbox('Gender', label_encoder_gender.classes_)\nAge = st.slider('Age', 18, 100)\nTenure = st.slider('Tenure', 0, 10)\nBalance = st.number_input('Balance')\nNumOfProducts = st.number_input('Number of Products')\nHasCrCard = st.selectbox(\"Has Credit Card?\", [0, 1])\nIsActiveMember = st.selectbox(\"Is Active Member?\", [0, 1])\nEstimatedSalary = st.number_input('Estimated Salary')\n\n'''\nst.number_input(), st.selectbox(), st.slider(): These functions create various input fields (numeric, dropdown, slider) on the \n                                                Streamlit web app to collect user input.\n'''\n\n\n5. Predict Button Logic:\n\n\nif st.button('Predict'):\n#st.button('Predict'): Creates a \"Predict\" button that triggers the code within this block when clicked.\n6. Preparing the Input Data:\n\n\n# Create a DataFrame for the input data\ninput_data = pd.DataFrame({\n    'CreditScore': [CreditScore],\n    'Geography': [Geography],\n    'Gender': [label_encoder_gender.transform([Gender])[0]], # Encoding categorical Gender value\n    'Age': [Age],\n    'Tenure': [Tenure],\n    'Balance': [Balance],\n    'NumOfProducts': [NumOfProducts],\n    'HasCrCard': [HasCrCard],\n    'IsActiveMember': [IsActiveMember],\n    'EstimatedSalary': [EstimatedSalary]\n})\n'''\nThis section creates a DataFrame from the user input, which will be used for making predictions.\nlabel_encoder_gender.transform([Gender])[0]: Encodes the selected gender using the pre-fitted LabelEncoder.\n'''\n\n7. One-Hot Encoding for Geography:\n\n# One hot encoding Geography\ngeo_encoded = one_hot_encoder_geo.transform([[Geography]]).toarray()\ngeo_encoded_df = pd.DataFrame(geo_encoded, columns=one_hot_encoder_geo.get_feature_names_out(['Geography']))\n\n# Concatenate the encoded columns with the input data\ninput_data = pd.concat([input_data, geo_encoded_df], axis=1)\ninput_data = input_data.drop(['Geography'], axis=1)\n'''\nOne-Hot Encoding: Converts the categorical Geography field into a set of binary columns.\nget_feature_names_out(['Geography']): Ensures the column names are consistent with how the model was trained.\n'''\n8. Scaling the Input Data:\n\n# Scaling input data\ninput_data = scaler.transform(input_data)\n\n'''\nscaler.transform(input_data): Applies the same scaling (normalization) that was applied to the training data.\n                              This step ensures that the model receives data in the format it expects.\n'''\n\n9. Making the Prediction:\n\n# Predict churn\nresult = model.predict(input_data)\nresult_prob = result[0][0]\nst.write(f'Churn Probability: {result_prob:.2f}')\n\n'''\nmodel.predict(input_data): Uses the trained ANN model to predict the probability of churn based on the input data.\nDisplaying Results: The predicted probability is displayed on the app.\n\n'''\n\n10. Displaying the Churn Result:\n\nif result_prob \u003e 0.5:\n    st.write('The customer is likely to churn.')\nelse:\n    st.write('The customer is not likely to churn.')\n#This condition checks the predicted probability against a threshold of 0.5 and displays whether the customer is likely to churn.\nSummary:\nThis Streamlit app takes user inputs related to customer data, processes these inputs (encoding, scaling),\nand uses a pre-trained ANN model to predict the likelihood of customer churn.\nThe app provides an interactive interface where users can input data, click a button to get predictions, and \nsee the results immediately.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftushar365%2Fsimple-ann","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftushar365%2Fsimple-ann","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftushar365%2Fsimple-ann/lists"}