Joining

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams['figure.dpi'] = 120

from mesh_predictor import DoubleProjectionPredictor
doe_single = pd.read_csv('../data/doe.csv')
doe_joining = pd.read_csv('../data/doe_joining.csv')
data = pd.read_csv('../data/joining.csv')
reg = DoubleProjectionPredictor()

reg.load_data(
    doe_joining=doe_joining, 
    doe_single=doe_single, 
    data=data, 
    process_parameters_joining = [
        'Spanner_1',
        'Spanner_2',
        'Spanner_3',
        'Spanner_4',
        'Oberblech_MID',
        'Unterblech_MID',
    ], 
    process_parameters_single = [
        'Blechdicke', 
        'Niederhalterkraft', 
        'Ziehspalt', 
        'Einlegeposition', 
        'Ziehtiefe',
        'Rp0',
    ], 
    position = ['u', 'v'], 
    output = ['x', 'y', 'z'], 
    categorical_joining=[
    ], 
    categorical_single= [
        'Ziehspalt', 
        'Ziehtiefe',
    ], 
    index_joining='doe_id', 
    index_single='doe_id', 
    part_index='pos', 
    top_bottom=['Oberblech_ID', 'Unterblech_ID'],
    validation_split=0.1, 
    validation_method="random"

)
reg.save_config("../models/joining_xyz.pkl")
reg.data_summary()
Data summary
------------------------------------------------------------

Joining process parameters:
    - Spanner_1 : numerical [ -5  ...  5 ]
    - Spanner_2 : numerical [ -5  ...  5 ]
    - Spanner_3 : numerical [ -5  ...  5 ]
    - Spanner_4 : numerical [ -5  ...  5 ]
    - Oberblech_MID : numerical [ 1  ...  6 ]
    - Unterblech_MID : numerical [ 1  ...  6 ]
Single process parameters:
    - Blechdicke : numerical [ 0.99  ...  1.48 ]
    - Niederhalterkraft : numerical [ 10  ...  500 ]
    - Ziehspalt : categorical [1.6, 2.4]
    - Einlegeposition : numerical [ -5  ...  5 ]
    - Ziehtiefe : categorical [30, 50, 70]
    - Rp0 : numerical [ 133.18263199999998  ...  296.5565 ]
Input variables:
    - u : numerical, [ 0.0 / 1.0 ] 
    - v : numerical, [ 0.0 / 1.0 ] 
Output variable(s):
    - x : numerical, [ -203.5688019 / 203.2945709 ]
    - y : numerical, [ -122.5980301 / 99.30913544 ]
    - z : numerical, [ -50.89810181 / 57.64501572 ]

Inputs (14754123, 27)
Outputs (14754123, 3)
Total number of experiments: 321
Total number of samples: 14754123
Number of training samples: 13278710
Number of test samples: 1475413

config = {
    'batch_size': 2048*16,
    'max_epochs': 50,
    'layers': [256, 256, 256, 256, 256],
    'dropout': 0.0,
    'learning_rate': 0.001,
    'activation': 'lrelu'
}

reg.custom_model(save_path='../models/best_joining_model', config=config, verbose=True)
reg.training_summary()
reg.load_network('../models/best_joining_xyz_model')
idx = np.random.choice(data['doe_id'].unique()) 
print("Doe_ID", idx)
reg.compare(idx)
Doe_ID 440

idx = np.random.choice(data['doe_id'].unique()) 
print("Doe_ID", idx)
reg.compare_xyz(idx)
Doe_ID 465