Skip to content

Commit

Permalink
inital commit
Browse files Browse the repository at this point in the history
  • Loading branch information
TheColdIce committed Apr 8, 2024
1 parent 94848a1 commit 33db60c
Show file tree
Hide file tree
Showing 6 changed files with 114 additions and 0 deletions.
13 changes: 13 additions & 0 deletions auto-aml-data-gen/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
sudo code
1. define SAR/normal ratio
2. define bounds for params
3. define constraints, all features should have similar feature importance
4. define recall
5. set target FPR
3. set all distributions equal, simulate data, train and evaluate recall and FPR
if needed use recall and FPR to normalize
4. loop:
suggest config files that satisfies the target SAR/normal ratio
create aml data
train statistical models
end if recall and FPR are satisfied
Empty file added auto-aml-data-gen/m
Empty file.
Empty file added auto-aml-data-gen/main.py
Empty file.
37 changes: 37 additions & 0 deletions auto-aml-data-gen/param_files/test/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"general": {
"random_seed": 0,
"simulation_name": "100K_accts",
"total_steps": 367
},
"default": {
"min_amount": 1,
"max_amount": 150000,
"mean_amount": 637,
"std_amount": 500,
"mean_amount_sar": 1000,
"std_amount_sar": 500,
"prob_income": 0.0,
"mean_income": 0.0,
"std_income": 0.0,
"prob_income_sar": 0.0,
"mean_income_sar": 0.0,
"std_income_sar": 0.0,
"mean_outcome": 200.0,
"std_outcome": 500.0,
"mean_outcome_sar": 200.0,
"std_outcome_sar": 500.0,
"prob_spend_cash": 0.7,
"n_steps_balance_history": 56,
"mean_phone_change_frequency": 1460,
"std_phone_change_frequency": 365,
"mean_phone_change_frequency_sar": 365,
"std_phone_change_frequency_sar": 182,
"mean_bank_change_frequency": 1460,
"std_bank_change_frequency": 1,
"mean_bank_change_frequency_sar": 1460,
"std_bank_change_frequency_sar": 1,
"margin_ratio": 0.1,
"prob_participate_in_multiple_sars": 0.2
}
}
Empty file added auto-aml-data-gen/preprocess.py
Empty file.
64 changes: 64 additions & 0 deletions auto-aml-data-gen/simulate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import os
import json

def create_param_files(params:dict, param_file_folder:str):
if not os.path.exists(param_file_folder):
os.makedirs(param_file_folder)
config_params = params['config']
with open(os.path.join(param_file_folder, 'config.json'), 'w') as f:
json.dump(config_params, f, indent=2)
config_params = params['accounts']



params = {
'config': {
'general': {
'random_seed': 0,
'simulation_name': '100K_accts',
'total_steps': 367
},
'default': {
'min_amount': 1,
'max_amount': 150000,
'mean_amount': 637,
'std_amount': 500,
'mean_amount_sar': 1000,
'std_amount_sar': 500,
'prob_income': 0.0,
'mean_income': 0.0,
'std_income': 0.0,
'prob_income_sar': 0.0,
'mean_income_sar': 0.0,
'std_income_sar': 0.0,
'mean_outcome': 200.0,
'std_outcome': 500.0,
'mean_outcome_sar': 200.0,
'std_outcome_sar': 500.0,
'prob_spend_cash': 0.7,
'n_steps_balance_history': 56,
'mean_phone_change_frequency': 1460,
'std_phone_change_frequency': 365,
'mean_phone_change_frequency_sar': 365,
'std_phone_change_frequency_sar': 182,
'mean_bank_change_frequency': 1460,
'std_bank_change_frequency': 1,
'mean_bank_change_frequency_sar': 1460,
'std_bank_change_frequency_sar': 1,
'margin_ratio': 0.1,
'prob_participate_in_multiple_sars': 0.2
}
},
'accounts': [
(27700, 1000, 100000, 'SWE', 'I', 'swedbank'),
(13480, 1000, 100000, 'SWE', 'I', 'handelsbanken'),
(58820, 1000, 100000, 'SWE', 'I', 'other')
],
'normalModels': {
()
}
}

param_file_folder = 'param_files/test'

create_param_files(params, param_file_folder)

0 comments on commit 33db60c

Please sign in to comment.