Skip to content

Commit

Permalink
Update main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
AnujSaha0111 authored Oct 3, 2024
1 parent 5fe9951 commit bf7a001
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,21 @@
import argparse
import logging

logger=logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO) # Changed to INFO to reduce debug logs

def main(file_path, target_column):
# Import the dataset
logger.info("Importing dataset...")
df = pd.read_csv(file_path)

# Perform EDA
logger.debug("Performing EDA...")
# Perform EDA (Logging of EDA details might be done in XAIWrapper itself)
XAIWrapper.perform_eda(df)

X = df.drop(columns=[target_column])
y = df[target_column]

# Split the data
logger.debug("Splitting the data...")
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# Create models
Expand All @@ -38,11 +37,10 @@ def main(file_path, target_column):
}

# Create XAIWrapper instance
logger.debug("Creating XAIWrapper instance...")
xai = XAIWrapper()

# Fit the models and run XAI analysis
logger.debug("Fitting the models and run the XAI analysis...")
logger.info("Fitting the models and running the XAI analysis...")
xai.fit(models, X_train, y_train)
results = xai.analyze()

Expand All @@ -57,7 +55,6 @@ def main(file_path, target_column):
logger.error(f"An error occurred while generating the report: {str(e)}")

# Example of using the trained model for new predictions
logger.debug("Making the prediction...")
while True:
logger.info("\nEnter values for prediction (or 'q' to quit):")
user_input = {}
Expand Down Expand Up @@ -88,4 +85,4 @@ def main(file_path, target_column):
args = parser.parse_args()

logger.info("Starting the program...")
main(args.file_path, args.target_column)
main(args.file_path, args.target_column)

0 comments on commit bf7a001

Please sign in to comment.