Making Batch Predictions¶
In [1]:
Copied!
import pandas as pd
from ml4pd import components
from ml4pd.streams import MaterialStream
from ml4pd.aspen_units import Distillation
import numpy as np
import pandas as pd
from ml4pd import components
from ml4pd.streams import MaterialStream
from ml4pd.aspen_units import Distillation
import numpy as np
Specify Molecules in System¶
The participating molecules must first be specified.
In [2]:
Copied!
components.set_components(['acetone', '2-butanone'])
components.set_components(['acetone', '2-butanone'])
Create Streams¶
Similar to making a single prediction, molecules
and flowrates
have to be specified as dictionaries. MaterialStream
currently has limited support for broadcasting data of different shapes. Therefore, the best way to specify data is to create a pandas dataframe and feed in individual columns.
In [3]:
Copied!
feed_data = pd.DataFrame()
feed_data['name_A'] = ['acetone'] * 5
feed_data['name_B'] = ['2-butanone'] * 5
feed_data['flowrate_A'] = np.linspace(0.1, 1, 5)
feed_data['flowrate_B'] = np.linspace(0.5, 1, 5)
feed_data['vapor_fraction'] = [0] * 5
feed_data['pressure'] = np.linspace(0.1, 5, 5)
feed_data
feed_data = pd.DataFrame()
feed_data['name_A'] = ['acetone'] * 5
feed_data['name_B'] = ['2-butanone'] * 5
feed_data['flowrate_A'] = np.linspace(0.1, 1, 5)
feed_data['flowrate_B'] = np.linspace(0.5, 1, 5)
feed_data['vapor_fraction'] = [0] * 5
feed_data['pressure'] = np.linspace(0.1, 5, 5)
feed_data
Out[3]:
name_A | name_B | flowrate_A | flowrate_B | vapor_fraction | pressure | |
---|---|---|---|---|---|---|
0 | acetone | 2-butanone | 0.100 | 0.500 | 0 | 0.100 |
1 | acetone | 2-butanone | 0.325 | 0.625 | 0 | 1.325 |
2 | acetone | 2-butanone | 0.550 | 0.750 | 0 | 2.550 |
3 | acetone | 2-butanone | 0.775 | 0.875 | 0 | 3.775 |
4 | acetone | 2-butanone | 1.000 | 1.000 | 0 | 5.000 |
In [4]:
Copied!
feed_stream = MaterialStream()(
vapor_fraction=feed_data['vapor_fraction'].to_list(),
pressure=feed_data['pressure'].to_list(),
molecules=feed_data[['name_A', 'name_B']].to_dict('list'),
flowrates=feed_data[['flowrate_A', 'flowrate_B']].to_dict('list'),
)
feed_stream.data.head()
feed_stream = MaterialStream()(
vapor_fraction=feed_data['vapor_fraction'].to_list(),
pressure=feed_data['pressure'].to_list(),
molecules=feed_data[['name_A', 'name_B']].to_dict('list'),
flowrates=feed_data[['flowrate_A', 'flowrate_B']].to_dict('list'),
)
feed_stream.data.head()
Out[4]:
name_A | name_B | smiles_A | iupac_A | cas_A | MaxEStateIndex_A | MinEStateIndex_A | qed_A | MolWt_A | HeavyAtomMolWt_A | NumValenceElectrons_A | MaxPartialCharge_A | MinPartialCharge_A | FpDensityMorgan1_A | FpDensityMorgan2_A | FpDensityMorgan3_A | BCUT2D_MWHI_A | BCUT2D_MWLOW_A | BCUT2D_CHGHI_A | BCUT2D_CHGLO_A | BCUT2D_LOGPHI_A | BCUT2D_LOGPLOW_A | BCUT2D_MRHI_A | BCUT2D_MRLOW_A | BalabanJ_A | BertzCT_A | Chi0_A | Chi0n_A | Chi0v_A | Chi1_A | Chi1n_A | Chi1v_A | Chi2n_A | Chi2v_A | Chi3n_A | Chi3v_A | Chi4n_A | Chi4v_A | HallKierAlpha_A | Ipc_A | Kappa1_A | Kappa2_A | Kappa3_A | LabuteASA_A | PEOE_VSA1_A | PEOE_VSA10_A | PEOE_VSA14_A | PEOE_VSA2_A | PEOE_VSA4_A | PEOE_VSA6_A | PEOE_VSA7_A | PEOE_VSA8_A | SMR_VSA1_A | SMR_VSA10_A | SMR_VSA5_A | SlogP_VSA2_A | SlogP_VSA3_A | SlogP_VSA5_A | TPSA_A | EState_VSA10_A | EState_VSA2_A | EState_VSA3_A | EState_VSA4_A | EState_VSA5_A | EState_VSA6_A | EState_VSA7_A | EState_VSA8_A | EState_VSA9_A | VSA_EState2_A | VSA_EState5_A | VSA_EState7_A | VSA_EState8_A | FractionCSP3_A | HeavyAtomCount_A | NHOHCount_A | NOCount_A | NumHAcceptors_A | NumHeteroatoms_A | NumRotatableBonds_A | MolLogP_A | MolMR_A | fr_C_O_A | fr_C_O_noCOO_A | fr_ketone_A | fr_ketone_Topliss_A | fr_unbrch_alkane_A | tm_A | tb_A | tc_A | pc_A | vc_A | z_A | rhoc_A | acenttric_factor_A | triple_temp_A | triple_pres_A | heat_vaporization_A | heat_fusion_A | stockmayer_param_A | solubility_param_A | parachor_A | smiles_B | iupac_B | cas_B | MaxEStateIndex_B | MinEStateIndex_B | qed_B | MolWt_B | HeavyAtomMolWt_B | NumValenceElectrons_B | MaxPartialCharge_B | MinPartialCharge_B | FpDensityMorgan1_B | FpDensityMorgan2_B | FpDensityMorgan3_B | BCUT2D_MWHI_B | BCUT2D_MWLOW_B | BCUT2D_CHGHI_B | BCUT2D_CHGLO_B | BCUT2D_LOGPHI_B | BCUT2D_LOGPLOW_B | BCUT2D_MRHI_B | BCUT2D_MRLOW_B | BalabanJ_B | BertzCT_B | Chi0_B | Chi0n_B | Chi0v_B | Chi1_B | Chi1n_B | Chi1v_B | Chi2n_B | Chi2v_B | Chi3n_B | Chi3v_B | Chi4n_B | Chi4v_B | HallKierAlpha_B | Ipc_B | Kappa1_B | Kappa2_B | Kappa3_B | LabuteASA_B | PEOE_VSA1_B | PEOE_VSA10_B | PEOE_VSA14_B | PEOE_VSA2_B | PEOE_VSA4_B | PEOE_VSA6_B | PEOE_VSA7_B | PEOE_VSA8_B | SMR_VSA1_B | SMR_VSA10_B | SMR_VSA5_B | SlogP_VSA2_B | SlogP_VSA3_B | SlogP_VSA5_B | TPSA_B | EState_VSA10_B | EState_VSA2_B | EState_VSA3_B | EState_VSA4_B | EState_VSA5_B | EState_VSA6_B | EState_VSA7_B | EState_VSA8_B | EState_VSA9_B | VSA_EState2_B | VSA_EState5_B | VSA_EState7_B | VSA_EState8_B | FractionCSP3_B | HeavyAtomCount_B | NHOHCount_B | NOCount_B | NumHAcceptors_B | NumHeteroatoms_B | NumRotatableBonds_B | MolLogP_B | MolMR_B | fr_C_O_B | fr_C_O_noCOO_B | fr_ketone_B | fr_ketone_Topliss_B | fr_unbrch_alkane_B | tm_B | tb_B | tc_B | pc_B | vc_B | z_B | rhoc_B | acenttric_factor_B | triple_temp_B | triple_pres_B | heat_vaporization_B | heat_fusion_B | stockmayer_param_B | solubility_param_B | parachor_B | feed0_flowrate_A | feed0_flowrate_B | feed0_temperature | feed0_vapor_fraction | feed0_pressure | feed0_comp_no | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | acetone | 2-butanone | CC(=O)C | propan-2-one | 67-64-1 | 9.444444 | 0.166667 | 0.398237 | 58.08 | 52.032 | 24 | 0.126268 | -0.300344 | 1.5 | 1.5 | 1.5 | 16.136528 | 10.550822 | 1.619125 | -1.557836 | 1.500722 | -1.691321 | 5.717069 | -0.114493 | 2.803039 | 26.264663 | 3.57735 | 2.908248 | 2.908248 | 1.732051 | 1.204124 | 1.204124 | 0.908248 | 0.908248 | 0.0 | 0.0 | 0.0 | 0.0 | -0.33 | 3.245112 | 3.67 | 1.044532 | 6.883958 | 25.630657 | 4.794537 | 5.783245 | 0.0 | 0.0 | 0.0 | 0.0 | 13.847474 | 0.0 | 4.794537 | 5.783245 | 13.847474 | 5.783245 | 4.794537 | 13.847474 | 17.07 | 4.794537 | 5.783245 | 0.0 | 0.0 | 13.847474 | 0.0 | 0.0 | 0.0 | 0.0 | 9.444444 | 0.166667 | 0.0 | 3.055556 | 0.666667 | 4 | 0 | 1 | 1 | 1 | 0 | 0.5953 | 16.355 | 1 | 1 | 1 | 1 | 0 | 178.35 | 329.23 | 508.1 | 4700000.0 | 0.000213 | 0.23697 | 272.672019 | 0.309 | 176.732207 | 3.047365 | 29122.034793 | 5770.0 | 332.97 | 19638.941183 | 0.000029 | CCC(=O)C | butan-2-one | 78-93-3 | 9.8125 | 0.25463 | 0.451051 | 72.107 | 64.043 | 30 | 0.129065 | -0.300042 | 1.8 | 2.0 | 2.0 | 16.137114 | 10.3607 | 1.764362 | -1.711045 | 1.710825 | -1.797012 | 5.744225 | -0.116199 | 2.847379 | 38.912609 | 4.284457 | 3.615355 | 3.615355 | 2.270056 | 1.764784 | 1.764784 | 1.055568 | 1.055568 | 0.497891 | 0.497891 | 0.0 | 0.0 | -0.33 | 9.651484 | 4.67 | 1.94248 | 3.67 | 31.995599 | 4.794537 | 5.783245 | 0.0 | 0.0 | 0.0 | 6.923737 | 6.923737 | 6.420822 | 4.794537 | 5.783245 | 20.268296 | 5.783245 | 4.794537 | 20.268296 | 17.07 | 4.794537 | 5.783245 | 6.420822 | 0.0 | 0.0 | 6.923737 | 6.923737 | 0.0 | 0.0 | 9.8125 | 0.25463 | 0.666667 | 3.43287 | 0.75 | 5 | 0 | 1 | 1 | 1 | 1 | 0.9854 | 20.972 | 1 | 1 | 1 | 1 | 0 | 186.35 | 352.75 | 536.7 | 4207000.0 | 0.000267 | 0.25172 | 270.058876 | 0.329 | 186.46881 | 1.735133 | 31555.836658 | 8390.0 | 415.48 | 18879.750645 | 0.000036 | 0.166667 | 0.833333 | None | 0 | 0.100 | 2 |
1 | acetone | 2-butanone | CC(=O)C | propan-2-one | 67-64-1 | 9.444444 | 0.166667 | 0.398237 | 58.08 | 52.032 | 24 | 0.126268 | -0.300344 | 1.5 | 1.5 | 1.5 | 16.136528 | 10.550822 | 1.619125 | -1.557836 | 1.500722 | -1.691321 | 5.717069 | -0.114493 | 2.803039 | 26.264663 | 3.57735 | 2.908248 | 2.908248 | 1.732051 | 1.204124 | 1.204124 | 0.908248 | 0.908248 | 0.0 | 0.0 | 0.0 | 0.0 | -0.33 | 3.245112 | 3.67 | 1.044532 | 6.883958 | 25.630657 | 4.794537 | 5.783245 | 0.0 | 0.0 | 0.0 | 0.0 | 13.847474 | 0.0 | 4.794537 | 5.783245 | 13.847474 | 5.783245 | 4.794537 | 13.847474 | 17.07 | 4.794537 | 5.783245 | 0.0 | 0.0 | 13.847474 | 0.0 | 0.0 | 0.0 | 0.0 | 9.444444 | 0.166667 | 0.0 | 3.055556 | 0.666667 | 4 | 0 | 1 | 1 | 1 | 0 | 0.5953 | 16.355 | 1 | 1 | 1 | 1 | 0 | 178.35 | 329.23 | 508.1 | 4700000.0 | 0.000213 | 0.23697 | 272.672019 | 0.309 | 176.732207 | 3.047365 | 29122.034793 | 5770.0 | 332.97 | 19638.941183 | 0.000029 | CCC(=O)C | butan-2-one | 78-93-3 | 9.8125 | 0.25463 | 0.451051 | 72.107 | 64.043 | 30 | 0.129065 | -0.300042 | 1.8 | 2.0 | 2.0 | 16.137114 | 10.3607 | 1.764362 | -1.711045 | 1.710825 | -1.797012 | 5.744225 | -0.116199 | 2.847379 | 38.912609 | 4.284457 | 3.615355 | 3.615355 | 2.270056 | 1.764784 | 1.764784 | 1.055568 | 1.055568 | 0.497891 | 0.497891 | 0.0 | 0.0 | -0.33 | 9.651484 | 4.67 | 1.94248 | 3.67 | 31.995599 | 4.794537 | 5.783245 | 0.0 | 0.0 | 0.0 | 6.923737 | 6.923737 | 6.420822 | 4.794537 | 5.783245 | 20.268296 | 5.783245 | 4.794537 | 20.268296 | 17.07 | 4.794537 | 5.783245 | 6.420822 | 0.0 | 0.0 | 6.923737 | 6.923737 | 0.0 | 0.0 | 9.8125 | 0.25463 | 0.666667 | 3.43287 | 0.75 | 5 | 0 | 1 | 1 | 1 | 1 | 0.9854 | 20.972 | 1 | 1 | 1 | 1 | 0 | 186.35 | 352.75 | 536.7 | 4207000.0 | 0.000267 | 0.25172 | 270.058876 | 0.329 | 186.46881 | 1.735133 | 31555.836658 | 8390.0 | 415.48 | 18879.750645 | 0.000036 | 0.342105 | 0.657895 | None | 0 | 1.325 | 2 |
2 | acetone | 2-butanone | CC(=O)C | propan-2-one | 67-64-1 | 9.444444 | 0.166667 | 0.398237 | 58.08 | 52.032 | 24 | 0.126268 | -0.300344 | 1.5 | 1.5 | 1.5 | 16.136528 | 10.550822 | 1.619125 | -1.557836 | 1.500722 | -1.691321 | 5.717069 | -0.114493 | 2.803039 | 26.264663 | 3.57735 | 2.908248 | 2.908248 | 1.732051 | 1.204124 | 1.204124 | 0.908248 | 0.908248 | 0.0 | 0.0 | 0.0 | 0.0 | -0.33 | 3.245112 | 3.67 | 1.044532 | 6.883958 | 25.630657 | 4.794537 | 5.783245 | 0.0 | 0.0 | 0.0 | 0.0 | 13.847474 | 0.0 | 4.794537 | 5.783245 | 13.847474 | 5.783245 | 4.794537 | 13.847474 | 17.07 | 4.794537 | 5.783245 | 0.0 | 0.0 | 13.847474 | 0.0 | 0.0 | 0.0 | 0.0 | 9.444444 | 0.166667 | 0.0 | 3.055556 | 0.666667 | 4 | 0 | 1 | 1 | 1 | 0 | 0.5953 | 16.355 | 1 | 1 | 1 | 1 | 0 | 178.35 | 329.23 | 508.1 | 4700000.0 | 0.000213 | 0.23697 | 272.672019 | 0.309 | 176.732207 | 3.047365 | 29122.034793 | 5770.0 | 332.97 | 19638.941183 | 0.000029 | CCC(=O)C | butan-2-one | 78-93-3 | 9.8125 | 0.25463 | 0.451051 | 72.107 | 64.043 | 30 | 0.129065 | -0.300042 | 1.8 | 2.0 | 2.0 | 16.137114 | 10.3607 | 1.764362 | -1.711045 | 1.710825 | -1.797012 | 5.744225 | -0.116199 | 2.847379 | 38.912609 | 4.284457 | 3.615355 | 3.615355 | 2.270056 | 1.764784 | 1.764784 | 1.055568 | 1.055568 | 0.497891 | 0.497891 | 0.0 | 0.0 | -0.33 | 9.651484 | 4.67 | 1.94248 | 3.67 | 31.995599 | 4.794537 | 5.783245 | 0.0 | 0.0 | 0.0 | 6.923737 | 6.923737 | 6.420822 | 4.794537 | 5.783245 | 20.268296 | 5.783245 | 4.794537 | 20.268296 | 17.07 | 4.794537 | 5.783245 | 6.420822 | 0.0 | 0.0 | 6.923737 | 6.923737 | 0.0 | 0.0 | 9.8125 | 0.25463 | 0.666667 | 3.43287 | 0.75 | 5 | 0 | 1 | 1 | 1 | 1 | 0.9854 | 20.972 | 1 | 1 | 1 | 1 | 0 | 186.35 | 352.75 | 536.7 | 4207000.0 | 0.000267 | 0.25172 | 270.058876 | 0.329 | 186.46881 | 1.735133 | 31555.836658 | 8390.0 | 415.48 | 18879.750645 | 0.000036 | 0.423077 | 0.576923 | None | 0 | 2.550 | 2 |
3 | acetone | 2-butanone | CC(=O)C | propan-2-one | 67-64-1 | 9.444444 | 0.166667 | 0.398237 | 58.08 | 52.032 | 24 | 0.126268 | -0.300344 | 1.5 | 1.5 | 1.5 | 16.136528 | 10.550822 | 1.619125 | -1.557836 | 1.500722 | -1.691321 | 5.717069 | -0.114493 | 2.803039 | 26.264663 | 3.57735 | 2.908248 | 2.908248 | 1.732051 | 1.204124 | 1.204124 | 0.908248 | 0.908248 | 0.0 | 0.0 | 0.0 | 0.0 | -0.33 | 3.245112 | 3.67 | 1.044532 | 6.883958 | 25.630657 | 4.794537 | 5.783245 | 0.0 | 0.0 | 0.0 | 0.0 | 13.847474 | 0.0 | 4.794537 | 5.783245 | 13.847474 | 5.783245 | 4.794537 | 13.847474 | 17.07 | 4.794537 | 5.783245 | 0.0 | 0.0 | 13.847474 | 0.0 | 0.0 | 0.0 | 0.0 | 9.444444 | 0.166667 | 0.0 | 3.055556 | 0.666667 | 4 | 0 | 1 | 1 | 1 | 0 | 0.5953 | 16.355 | 1 | 1 | 1 | 1 | 0 | 178.35 | 329.23 | 508.1 | 4700000.0 | 0.000213 | 0.23697 | 272.672019 | 0.309 | 176.732207 | 3.047365 | 29122.034793 | 5770.0 | 332.97 | 19638.941183 | 0.000029 | CCC(=O)C | butan-2-one | 78-93-3 | 9.8125 | 0.25463 | 0.451051 | 72.107 | 64.043 | 30 | 0.129065 | -0.300042 | 1.8 | 2.0 | 2.0 | 16.137114 | 10.3607 | 1.764362 | -1.711045 | 1.710825 | -1.797012 | 5.744225 | -0.116199 | 2.847379 | 38.912609 | 4.284457 | 3.615355 | 3.615355 | 2.270056 | 1.764784 | 1.764784 | 1.055568 | 1.055568 | 0.497891 | 0.497891 | 0.0 | 0.0 | -0.33 | 9.651484 | 4.67 | 1.94248 | 3.67 | 31.995599 | 4.794537 | 5.783245 | 0.0 | 0.0 | 0.0 | 6.923737 | 6.923737 | 6.420822 | 4.794537 | 5.783245 | 20.268296 | 5.783245 | 4.794537 | 20.268296 | 17.07 | 4.794537 | 5.783245 | 6.420822 | 0.0 | 0.0 | 6.923737 | 6.923737 | 0.0 | 0.0 | 9.8125 | 0.25463 | 0.666667 | 3.43287 | 0.75 | 5 | 0 | 1 | 1 | 1 | 1 | 0.9854 | 20.972 | 1 | 1 | 1 | 1 | 0 | 186.35 | 352.75 | 536.7 | 4207000.0 | 0.000267 | 0.25172 | 270.058876 | 0.329 | 186.46881 | 1.735133 | 31555.836658 | 8390.0 | 415.48 | 18879.750645 | 0.000036 | 0.469697 | 0.530303 | None | 0 | 3.775 | 2 |
4 | acetone | 2-butanone | CC(=O)C | propan-2-one | 67-64-1 | 9.444444 | 0.166667 | 0.398237 | 58.08 | 52.032 | 24 | 0.126268 | -0.300344 | 1.5 | 1.5 | 1.5 | 16.136528 | 10.550822 | 1.619125 | -1.557836 | 1.500722 | -1.691321 | 5.717069 | -0.114493 | 2.803039 | 26.264663 | 3.57735 | 2.908248 | 2.908248 | 1.732051 | 1.204124 | 1.204124 | 0.908248 | 0.908248 | 0.0 | 0.0 | 0.0 | 0.0 | -0.33 | 3.245112 | 3.67 | 1.044532 | 6.883958 | 25.630657 | 4.794537 | 5.783245 | 0.0 | 0.0 | 0.0 | 0.0 | 13.847474 | 0.0 | 4.794537 | 5.783245 | 13.847474 | 5.783245 | 4.794537 | 13.847474 | 17.07 | 4.794537 | 5.783245 | 0.0 | 0.0 | 13.847474 | 0.0 | 0.0 | 0.0 | 0.0 | 9.444444 | 0.166667 | 0.0 | 3.055556 | 0.666667 | 4 | 0 | 1 | 1 | 1 | 0 | 0.5953 | 16.355 | 1 | 1 | 1 | 1 | 0 | 178.35 | 329.23 | 508.1 | 4700000.0 | 0.000213 | 0.23697 | 272.672019 | 0.309 | 176.732207 | 3.047365 | 29122.034793 | 5770.0 | 332.97 | 19638.941183 | 0.000029 | CCC(=O)C | butan-2-one | 78-93-3 | 9.8125 | 0.25463 | 0.451051 | 72.107 | 64.043 | 30 | 0.129065 | -0.300042 | 1.8 | 2.0 | 2.0 | 16.137114 | 10.3607 | 1.764362 | -1.711045 | 1.710825 | -1.797012 | 5.744225 | -0.116199 | 2.847379 | 38.912609 | 4.284457 | 3.615355 | 3.615355 | 2.270056 | 1.764784 | 1.764784 | 1.055568 | 1.055568 | 0.497891 | 0.497891 | 0.0 | 0.0 | -0.33 | 9.651484 | 4.67 | 1.94248 | 3.67 | 31.995599 | 4.794537 | 5.783245 | 0.0 | 0.0 | 0.0 | 6.923737 | 6.923737 | 6.420822 | 4.794537 | 5.783245 | 20.268296 | 5.783245 | 4.794537 | 20.268296 | 17.07 | 4.794537 | 5.783245 | 6.420822 | 0.0 | 0.0 | 6.923737 | 6.923737 | 0.0 | 0.0 | 9.8125 | 0.25463 | 0.666667 | 3.43287 | 0.75 | 5 | 0 | 1 | 1 | 1 | 1 | 0.9854 | 20.972 | 1 | 1 | 1 | 1 | 0 | 186.35 | 352.75 | 536.7 | 4207000.0 | 0.000267 | 0.25172 | 270.058876 | 0.329 | 186.46881 | 1.735133 | 31555.836658 | 8390.0 | 415.48 | 18879.750645 | 0.000036 | 0.500000 | 0.500000 | None | 0 | 5.000 | 2 |
Create Columns¶
As with MaterialStream
, the best way to prepare for batch predicitons with columns is to create a dataframe and feed in individual colums. The length of this df must match the df fed into MaterialStream
. For Distillation
, if the feed stage isn't specified (via feed_stage
), the column will default to half of no_stages
.
In [5]:
Copied!
col_data = pd.DataFrame()
col_data['no_stages'] = np.arange(5, 20, 3)
col_data['pressure'] = np.linspace(0.1, 5, 5)
col_data['reflux_ratio'] = np.linspace(5, 15, 5)
col_data['boilup_ratio'] = np.linspace(10, 15, 5)
col_data
col_data = pd.DataFrame()
col_data['no_stages'] = np.arange(5, 20, 3)
col_data['pressure'] = np.linspace(0.1, 5, 5)
col_data['reflux_ratio'] = np.linspace(5, 15, 5)
col_data['boilup_ratio'] = np.linspace(10, 15, 5)
col_data
Out[5]:
no_stages | pressure | reflux_ratio | boilup_ratio | |
---|---|---|---|---|
0 | 5 | 0.100 | 5.0 | 10.00 |
1 | 8 | 1.325 | 7.5 | 11.25 |
2 | 11 | 2.550 | 10.0 | 12.50 |
3 | 14 | 3.775 | 12.5 | 13.75 |
4 | 17 | 5.000 | 15.0 | 15.00 |
In [6]:
Copied!
dist_col_1 = Distillation(
no_stages = col_data['no_stages'].to_list(),
pressure = col_data['pressure'].to_list(),
reflux_ratio = col_data['reflux_ratio'].to_list(),
boilup_ratio = col_data['boilup_ratio'].to_list(),
)
bott_stream, dist_stream = dist_col_1(feed_stream)
bott_stream.data.head()
dist_col_1 = Distillation(
no_stages = col_data['no_stages'].to_list(),
pressure = col_data['pressure'].to_list(),
reflux_ratio = col_data['reflux_ratio'].to_list(),
boilup_ratio = col_data['boilup_ratio'].to_list(),
)
bott_stream, dist_stream = dist_col_1(feed_stream)
bott_stream.data.head()
c:\users\hvo\desktop\ml4pd\ml4pd\aspen_unit_ops\distillation.py:160: UserWarning: feed_stage not specified, setting it equal to half no_stages. self._check_feed_stage()
Out[6]:
name_A | name_B | smiles_A | iupac_A | cas_A | MaxEStateIndex_A | MinEStateIndex_A | qed_A | MolWt_A | HeavyAtomMolWt_A | NumValenceElectrons_A | MaxPartialCharge_A | MinPartialCharge_A | FpDensityMorgan1_A | FpDensityMorgan2_A | FpDensityMorgan3_A | BCUT2D_MWHI_A | BCUT2D_MWLOW_A | BCUT2D_CHGHI_A | BCUT2D_CHGLO_A | BCUT2D_LOGPHI_A | BCUT2D_LOGPLOW_A | BCUT2D_MRHI_A | BCUT2D_MRLOW_A | BalabanJ_A | BertzCT_A | Chi0_A | Chi0n_A | Chi0v_A | Chi1_A | Chi1n_A | Chi1v_A | Chi2n_A | Chi2v_A | Chi3n_A | Chi3v_A | Chi4n_A | Chi4v_A | HallKierAlpha_A | Ipc_A | Kappa1_A | Kappa2_A | Kappa3_A | LabuteASA_A | PEOE_VSA1_A | PEOE_VSA10_A | PEOE_VSA14_A | PEOE_VSA2_A | PEOE_VSA4_A | PEOE_VSA6_A | PEOE_VSA7_A | PEOE_VSA8_A | SMR_VSA1_A | SMR_VSA10_A | SMR_VSA5_A | SlogP_VSA2_A | SlogP_VSA3_A | SlogP_VSA5_A | TPSA_A | EState_VSA10_A | EState_VSA2_A | EState_VSA3_A | EState_VSA4_A | EState_VSA5_A | EState_VSA6_A | EState_VSA7_A | EState_VSA8_A | EState_VSA9_A | VSA_EState2_A | VSA_EState5_A | VSA_EState7_A | VSA_EState8_A | FractionCSP3_A | HeavyAtomCount_A | NHOHCount_A | NOCount_A | NumHAcceptors_A | NumHeteroatoms_A | NumRotatableBonds_A | MolLogP_A | MolMR_A | fr_C_O_A | fr_C_O_noCOO_A | fr_ketone_A | fr_ketone_Topliss_A | fr_unbrch_alkane_A | tm_A | tb_A | tc_A | pc_A | vc_A | z_A | rhoc_A | acenttric_factor_A | triple_temp_A | triple_pres_A | heat_vaporization_A | heat_fusion_A | stockmayer_param_A | solubility_param_A | parachor_A | smiles_B | iupac_B | cas_B | MaxEStateIndex_B | MinEStateIndex_B | qed_B | MolWt_B | HeavyAtomMolWt_B | NumValenceElectrons_B | MaxPartialCharge_B | MinPartialCharge_B | FpDensityMorgan1_B | FpDensityMorgan2_B | FpDensityMorgan3_B | BCUT2D_MWHI_B | BCUT2D_MWLOW_B | BCUT2D_CHGHI_B | BCUT2D_CHGLO_B | BCUT2D_LOGPHI_B | BCUT2D_LOGPLOW_B | BCUT2D_MRHI_B | BCUT2D_MRLOW_B | BalabanJ_B | BertzCT_B | Chi0_B | Chi0n_B | Chi0v_B | Chi1_B | Chi1n_B | Chi1v_B | Chi2n_B | Chi2v_B | Chi3n_B | Chi3v_B | Chi4n_B | Chi4v_B | HallKierAlpha_B | Ipc_B | Kappa1_B | Kappa2_B | Kappa3_B | LabuteASA_B | PEOE_VSA1_B | PEOE_VSA10_B | PEOE_VSA14_B | PEOE_VSA2_B | PEOE_VSA4_B | PEOE_VSA6_B | PEOE_VSA7_B | PEOE_VSA8_B | SMR_VSA1_B | SMR_VSA10_B | SMR_VSA5_B | SlogP_VSA2_B | SlogP_VSA3_B | SlogP_VSA5_B | TPSA_B | EState_VSA10_B | EState_VSA2_B | EState_VSA3_B | EState_VSA4_B | EState_VSA5_B | EState_VSA6_B | EState_VSA7_B | EState_VSA8_B | EState_VSA9_B | VSA_EState2_B | VSA_EState5_B | VSA_EState7_B | VSA_EState8_B | FractionCSP3_B | HeavyAtomCount_B | NHOHCount_B | NOCount_B | NumHAcceptors_B | NumHeteroatoms_B | NumRotatableBonds_B | MolLogP_B | MolMR_B | fr_C_O_B | fr_C_O_noCOO_B | fr_ketone_B | fr_ketone_Topliss_B | fr_unbrch_alkane_B | tm_B | tb_B | tc_B | pc_B | vc_B | z_B | rhoc_B | acenttric_factor_B | triple_temp_B | triple_pres_B | heat_vaporization_B | heat_fusion_B | stockmayer_param_B | solubility_param_B | parachor_B | bott1_flowrate_A | bott1_flowrate_B | bott1_temperature | bott1_vapor_fraction | bott1_pressure | bott1_comp_no | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | acetone | 2-butanone | CC(=O)C | propan-2-one | 67-64-1 | 9.444444 | 0.166667 | 0.398237 | 58.08 | 52.032 | 24 | 0.126268 | -0.300344 | 1.5 | 1.5 | 1.5 | 16.136528 | 10.550822 | 1.619125 | -1.557836 | 1.500722 | -1.691321 | 5.717069 | -0.114493 | 2.803039 | 26.264663 | 3.57735 | 2.908248 | 2.908248 | 1.732051 | 1.204124 | 1.204124 | 0.908248 | 0.908248 | 0.0 | 0.0 | 0.0 | 0.0 | -0.33 | 3.245112 | 3.67 | 1.044532 | 6.883958 | 25.630657 | 4.794537 | 5.783245 | 0.0 | 0.0 | 0.0 | 0.0 | 13.847474 | 0.0 | 4.794537 | 5.783245 | 13.847474 | 5.783245 | 4.794537 | 13.847474 | 17.07 | 4.794537 | 5.783245 | 0.0 | 0.0 | 13.847474 | 0.0 | 0.0 | 0.0 | 0.0 | 9.444444 | 0.166667 | 0.0 | 3.055556 | 0.666667 | 4 | 0 | 1 | 1 | 1 | 0 | 0.5953 | 16.355 | 1 | 1 | 1 | 1 | 0 | 178.35 | 329.23 | 508.1 | 4700000.0 | 0.000213 | 0.23697 | 272.672019 | 0.309 | 176.732207 | 3.047365 | 29122.034793 | 5770.0 | 332.97 | 19638.941183 | 0.000029 | CCC(=O)C | butan-2-one | 78-93-3 | 9.8125 | 0.25463 | 0.451051 | 72.107 | 64.043 | 30 | 0.129065 | -0.300042 | 1.8 | 2.0 | 2.0 | 16.137114 | 10.3607 | 1.764362 | -1.711045 | 1.710825 | -1.797012 | 5.744225 | -0.116199 | 2.847379 | 38.912609 | 4.284457 | 3.615355 | 3.615355 | 2.270056 | 1.764784 | 1.764784 | 1.055568 | 1.055568 | 0.497891 | 0.497891 | 0.0 | 0.0 | -0.33 | 9.651484 | 4.67 | 1.94248 | 3.67 | 31.995599 | 4.794537 | 5.783245 | 0.0 | 0.0 | 0.0 | 6.923737 | 6.923737 | 6.420822 | 4.794537 | 5.783245 | 20.268296 | 5.783245 | 4.794537 | 20.268296 | 17.07 | 4.794537 | 5.783245 | 6.420822 | 0.0 | 0.0 | 6.923737 | 6.923737 | 0.0 | 0.0 | 9.8125 | 0.25463 | 0.666667 | 3.43287 | 0.75 | 5 | 0 | 1 | 1 | 1 | 1 | 0.9854 | 20.972 | 1 | 1 | 1 | 1 | 0 | 186.35 | 352.75 | 536.7 | 4207000.0 | 0.000267 | 0.25172 | 270.058876 | 0.329 | 186.46881 | 1.735133 | 31555.836658 | 8390.0 | 415.48 | 18879.750645 | 0.000036 | 0.037000 | 0.963000 | 33.321304 | 0 | None | 2 |
1 | acetone | 2-butanone | CC(=O)C | propan-2-one | 67-64-1 | 9.444444 | 0.166667 | 0.398237 | 58.08 | 52.032 | 24 | 0.126268 | -0.300344 | 1.5 | 1.5 | 1.5 | 16.136528 | 10.550822 | 1.619125 | -1.557836 | 1.500722 | -1.691321 | 5.717069 | -0.114493 | 2.803039 | 26.264663 | 3.57735 | 2.908248 | 2.908248 | 1.732051 | 1.204124 | 1.204124 | 0.908248 | 0.908248 | 0.0 | 0.0 | 0.0 | 0.0 | -0.33 | 3.245112 | 3.67 | 1.044532 | 6.883958 | 25.630657 | 4.794537 | 5.783245 | 0.0 | 0.0 | 0.0 | 0.0 | 13.847474 | 0.0 | 4.794537 | 5.783245 | 13.847474 | 5.783245 | 4.794537 | 13.847474 | 17.07 | 4.794537 | 5.783245 | 0.0 | 0.0 | 13.847474 | 0.0 | 0.0 | 0.0 | 0.0 | 9.444444 | 0.166667 | 0.0 | 3.055556 | 0.666667 | 4 | 0 | 1 | 1 | 1 | 0 | 0.5953 | 16.355 | 1 | 1 | 1 | 1 | 0 | 178.35 | 329.23 | 508.1 | 4700000.0 | 0.000213 | 0.23697 | 272.672019 | 0.309 | 176.732207 | 3.047365 | 29122.034793 | 5770.0 | 332.97 | 19638.941183 | 0.000029 | CCC(=O)C | butan-2-one | 78-93-3 | 9.8125 | 0.25463 | 0.451051 | 72.107 | 64.043 | 30 | 0.129065 | -0.300042 | 1.8 | 2.0 | 2.0 | 16.137114 | 10.3607 | 1.764362 | -1.711045 | 1.710825 | -1.797012 | 5.744225 | -0.116199 | 2.847379 | 38.912609 | 4.284457 | 3.615355 | 3.615355 | 2.270056 | 1.764784 | 1.764784 | 1.055568 | 1.055568 | 0.497891 | 0.497891 | 0.0 | 0.0 | -0.33 | 9.651484 | 4.67 | 1.94248 | 3.67 | 31.995599 | 4.794537 | 5.783245 | 0.0 | 0.0 | 0.0 | 6.923737 | 6.923737 | 6.420822 | 4.794537 | 5.783245 | 20.268296 | 5.783245 | 4.794537 | 20.268296 | 17.07 | 4.794537 | 5.783245 | 6.420822 | 0.0 | 0.0 | 6.923737 | 6.923737 | 0.0 | 0.0 | 9.8125 | 0.25463 | 0.666667 | 3.43287 | 0.75 | 5 | 0 | 1 | 1 | 1 | 1 | 0.9854 | 20.972 | 1 | 1 | 1 | 1 | 0 | 186.35 | 352.75 | 536.7 | 4207000.0 | 0.000267 | 0.25172 | 270.058876 | 0.329 | 186.46881 | 1.735133 | 31555.836658 | 8390.0 | 415.48 | 18879.750645 | 0.000036 | 0.047603 | 0.952397 | 94.753319 | 0 | None | 2 |
2 | acetone | 2-butanone | CC(=O)C | propan-2-one | 67-64-1 | 9.444444 | 0.166667 | 0.398237 | 58.08 | 52.032 | 24 | 0.126268 | -0.300344 | 1.5 | 1.5 | 1.5 | 16.136528 | 10.550822 | 1.619125 | -1.557836 | 1.500722 | -1.691321 | 5.717069 | -0.114493 | 2.803039 | 26.264663 | 3.57735 | 2.908248 | 2.908248 | 1.732051 | 1.204124 | 1.204124 | 0.908248 | 0.908248 | 0.0 | 0.0 | 0.0 | 0.0 | -0.33 | 3.245112 | 3.67 | 1.044532 | 6.883958 | 25.630657 | 4.794537 | 5.783245 | 0.0 | 0.0 | 0.0 | 0.0 | 13.847474 | 0.0 | 4.794537 | 5.783245 | 13.847474 | 5.783245 | 4.794537 | 13.847474 | 17.07 | 4.794537 | 5.783245 | 0.0 | 0.0 | 13.847474 | 0.0 | 0.0 | 0.0 | 0.0 | 9.444444 | 0.166667 | 0.0 | 3.055556 | 0.666667 | 4 | 0 | 1 | 1 | 1 | 0 | 0.5953 | 16.355 | 1 | 1 | 1 | 1 | 0 | 178.35 | 329.23 | 508.1 | 4700000.0 | 0.000213 | 0.23697 | 272.672019 | 0.309 | 176.732207 | 3.047365 | 29122.034793 | 5770.0 | 332.97 | 19638.941183 | 0.000029 | CCC(=O)C | butan-2-one | 78-93-3 | 9.8125 | 0.25463 | 0.451051 | 72.107 | 64.043 | 30 | 0.129065 | -0.300042 | 1.8 | 2.0 | 2.0 | 16.137114 | 10.3607 | 1.764362 | -1.711045 | 1.710825 | -1.797012 | 5.744225 | -0.116199 | 2.847379 | 38.912609 | 4.284457 | 3.615355 | 3.615355 | 2.270056 | 1.764784 | 1.764784 | 1.055568 | 1.055568 | 0.497891 | 0.497891 | 0.0 | 0.0 | -0.33 | 9.651484 | 4.67 | 1.94248 | 3.67 | 31.995599 | 4.794537 | 5.783245 | 0.0 | 0.0 | 0.0 | 6.923737 | 6.923737 | 6.420822 | 4.794537 | 5.783245 | 20.268296 | 5.783245 | 4.794537 | 20.268296 | 17.07 | 4.794537 | 5.783245 | 6.420822 | 0.0 | 0.0 | 6.923737 | 6.923737 | 0.0 | 0.0 | 9.8125 | 0.25463 | 0.666667 | 3.43287 | 0.75 | 5 | 0 | 1 | 1 | 1 | 1 | 0.9854 | 20.972 | 1 | 1 | 1 | 1 | 0 | 186.35 | 352.75 | 536.7 | 4207000.0 | 0.000267 | 0.25172 | 270.058876 | 0.329 | 186.46881 | 1.735133 | 31555.836658 | 8390.0 | 415.48 | 18879.750645 | 0.000036 | 0.057041 | 0.942959 | 117.115538 | 0 | None | 2 |
3 | acetone | 2-butanone | CC(=O)C | propan-2-one | 67-64-1 | 9.444444 | 0.166667 | 0.398237 | 58.08 | 52.032 | 24 | 0.126268 | -0.300344 | 1.5 | 1.5 | 1.5 | 16.136528 | 10.550822 | 1.619125 | -1.557836 | 1.500722 | -1.691321 | 5.717069 | -0.114493 | 2.803039 | 26.264663 | 3.57735 | 2.908248 | 2.908248 | 1.732051 | 1.204124 | 1.204124 | 0.908248 | 0.908248 | 0.0 | 0.0 | 0.0 | 0.0 | -0.33 | 3.245112 | 3.67 | 1.044532 | 6.883958 | 25.630657 | 4.794537 | 5.783245 | 0.0 | 0.0 | 0.0 | 0.0 | 13.847474 | 0.0 | 4.794537 | 5.783245 | 13.847474 | 5.783245 | 4.794537 | 13.847474 | 17.07 | 4.794537 | 5.783245 | 0.0 | 0.0 | 13.847474 | 0.0 | 0.0 | 0.0 | 0.0 | 9.444444 | 0.166667 | 0.0 | 3.055556 | 0.666667 | 4 | 0 | 1 | 1 | 1 | 0 | 0.5953 | 16.355 | 1 | 1 | 1 | 1 | 0 | 178.35 | 329.23 | 508.1 | 4700000.0 | 0.000213 | 0.23697 | 272.672019 | 0.309 | 176.732207 | 3.047365 | 29122.034793 | 5770.0 | 332.97 | 19638.941183 | 0.000029 | CCC(=O)C | butan-2-one | 78-93-3 | 9.8125 | 0.25463 | 0.451051 | 72.107 | 64.043 | 30 | 0.129065 | -0.300042 | 1.8 | 2.0 | 2.0 | 16.137114 | 10.3607 | 1.764362 | -1.711045 | 1.710825 | -1.797012 | 5.744225 | -0.116199 | 2.847379 | 38.912609 | 4.284457 | 3.615355 | 3.615355 | 2.270056 | 1.764784 | 1.764784 | 1.055568 | 1.055568 | 0.497891 | 0.497891 | 0.0 | 0.0 | -0.33 | 9.651484 | 4.67 | 1.94248 | 3.67 | 31.995599 | 4.794537 | 5.783245 | 0.0 | 0.0 | 0.0 | 6.923737 | 6.923737 | 6.420822 | 4.794537 | 5.783245 | 20.268296 | 5.783245 | 4.794537 | 20.268296 | 17.07 | 4.794537 | 5.783245 | 6.420822 | 0.0 | 0.0 | 6.923737 | 6.923737 | 0.0 | 0.0 | 9.8125 | 0.25463 | 0.666667 | 3.43287 | 0.75 | 5 | 0 | 1 | 1 | 1 | 1 | 0.9854 | 20.972 | 1 | 1 | 1 | 1 | 0 | 186.35 | 352.75 | 536.7 | 4207000.0 | 0.000267 | 0.25172 | 270.058876 | 0.329 | 186.46881 | 1.735133 | 31555.836658 | 8390.0 | 415.48 | 18879.750645 | 0.000036 | 0.086940 | 0.913060 | 130.265558 | 0 | None | 2 |
4 | acetone | 2-butanone | CC(=O)C | propan-2-one | 67-64-1 | 9.444444 | 0.166667 | 0.398237 | 58.08 | 52.032 | 24 | 0.126268 | -0.300344 | 1.5 | 1.5 | 1.5 | 16.136528 | 10.550822 | 1.619125 | -1.557836 | 1.500722 | -1.691321 | 5.717069 | -0.114493 | 2.803039 | 26.264663 | 3.57735 | 2.908248 | 2.908248 | 1.732051 | 1.204124 | 1.204124 | 0.908248 | 0.908248 | 0.0 | 0.0 | 0.0 | 0.0 | -0.33 | 3.245112 | 3.67 | 1.044532 | 6.883958 | 25.630657 | 4.794537 | 5.783245 | 0.0 | 0.0 | 0.0 | 0.0 | 13.847474 | 0.0 | 4.794537 | 5.783245 | 13.847474 | 5.783245 | 4.794537 | 13.847474 | 17.07 | 4.794537 | 5.783245 | 0.0 | 0.0 | 13.847474 | 0.0 | 0.0 | 0.0 | 0.0 | 9.444444 | 0.166667 | 0.0 | 3.055556 | 0.666667 | 4 | 0 | 1 | 1 | 1 | 0 | 0.5953 | 16.355 | 1 | 1 | 1 | 1 | 0 | 178.35 | 329.23 | 508.1 | 4700000.0 | 0.000213 | 0.23697 | 272.672019 | 0.309 | 176.732207 | 3.047365 | 29122.034793 | 5770.0 | 332.97 | 19638.941183 | 0.000029 | CCC(=O)C | butan-2-one | 78-93-3 | 9.8125 | 0.25463 | 0.451051 | 72.107 | 64.043 | 30 | 0.129065 | -0.300042 | 1.8 | 2.0 | 2.0 | 16.137114 | 10.3607 | 1.764362 | -1.711045 | 1.710825 | -1.797012 | 5.744225 | -0.116199 | 2.847379 | 38.912609 | 4.284457 | 3.615355 | 3.615355 | 2.270056 | 1.764784 | 1.764784 | 1.055568 | 1.055568 | 0.497891 | 0.497891 | 0.0 | 0.0 | -0.33 | 9.651484 | 4.67 | 1.94248 | 3.67 | 31.995599 | 4.794537 | 5.783245 | 0.0 | 0.0 | 0.0 | 6.923737 | 6.923737 | 6.420822 | 4.794537 | 5.783245 | 20.268296 | 5.783245 | 4.794537 | 20.268296 | 17.07 | 4.794537 | 5.783245 | 6.420822 | 0.0 | 0.0 | 6.923737 | 6.923737 | 0.0 | 0.0 | 9.8125 | 0.25463 | 0.666667 | 3.43287 | 0.75 | 5 | 0 | 1 | 1 | 1 | 1 | 0.9854 | 20.972 | 1 | 1 | 1 | 1 | 0 | 186.35 | 352.75 | 536.7 | 4207000.0 | 0.000267 | 0.25172 | 270.058876 | 0.329 | 186.46881 | 1.735133 | 31555.836658 | 8390.0 | 415.48 | 18879.750645 | 0.000036 | 0.098124 | 0.901876 | 146.988372 | 0 | None | 2 |
Inspect Results¶
In [7]:
Copied!
bott_stream.flow
bott_stream.flow
Out[7]:
flowrate_A | flowrate_B | |
---|---|---|
0 | 0.009261 | 0.241021 |
1 | 0.020690 | 0.413953 |
2 | 0.038617 | 0.638387 |
3 | 0.072857 | 0.765158 |
4 | 0.097979 | 0.900540 |
In [8]:
Copied!
dist_col_1.reboiler_duty
dist_col_1.reboiler_duty
Out[8]:
[84190.2765816079, 155501.57502790343, 240102.58214165608, 329183.35539542447, 454447.95065304945]