7f9976d67c9b413b3a7211bad921b29eac7be179,trunk/SUAVE/Methods/Power/Battery/Sizing/initialize_from_energy_and_power.py,,initialize_from_energy_and_power,#,18

Before Change


    if max=="soft": //use softmax function (makes it differentiable)
        
        min_mass=np.minimum(energy_mass, power_mass)
        mass=mass+np.log(1.+np.exp(min_mass-mass))  //write it this way to prevent overflow
            
    battery.mass_properties.mass=mass
    battery.max_energy=battery.specific_energy*mass

After Change


    mass=np.maximum(energy_mass, power_mass)
    if max=="soft": //use softmax function (makes it differentiable)
        scaling=10.**(np.floor(np.log10(mass))-1) //make it so the exponentials are taking ~10 (closer numerically, while still differentiable)
        mass=scaling*np.log(np.exp(energy_mass/scaling)+np.exp(power_mass/scaling))  //write it this way to prevent overflow

    battery.mass_properties.mass=mass
    battery.max_energy=battery.specific_energy*mass
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: suavecode/SUAVE
Commit Name: 7f9976d67c9b413b3a7211bad921b29eac7be179
Time: 2016-02-01
Author: jmvegh@stanford.edu
File Name: trunk/SUAVE/Methods/Power/Battery/Sizing/initialize_from_energy_and_power.py
Class Name:
Method Name: initialize_from_energy_and_power


Project Name: rasbt/mlxtend
Commit Name: 967e77866ca63db25f5b688db4be5d55480a1102
Time: 2016-07-13
Author: mail@sebastianraschka.com
File Name: mlxtend/classifier/multilayerperceptron.py
Class Name: MultiLayerPerceptron
Method Name: _softmax


Project Name: rasbt/mlxtend
Commit Name: 967e77866ca63db25f5b688db4be5d55480a1102
Time: 2016-07-13
Author: mail@sebastianraschka.com
File Name: mlxtend/classifier/softmax_regression.py
Class Name: SoftmaxRegression
Method Name: _softmax