@@ -53,17 +53,15 @@ export const find_beta_from_ci = ({ci_lower, ci_upper, ci_length}) => {
53
53
return [ df_da , df_db ]
54
54
}
55
55
56
- // point at which to give up
57
- let target_loss = 10e-8
58
56
// Try a sensible default
59
57
console . log ( "Try an initial approximation" )
60
58
let x0_init = [ 50 , 50 ]
61
59
let nelderMead_init = nelderMead ( loss , x0_init ) ;
62
60
let result_init = [ nelderMead_init . x [ 0 ] , nelderMead_init . x [ 1 ] ]
63
61
let loss_init = loss ( result_init )
64
- console . log ( `Initial loss: ${ loss_init } ` )
62
+ // console.log(loss_init)
65
63
66
- if ( loss_init < target_loss ) {
64
+ if ( loss < 10e-8 ) {
67
65
return result_init
68
66
}
69
67
@@ -80,8 +78,7 @@ export const find_beta_from_ci = ({ci_lower, ci_upper, ci_length}) => {
80
78
let new_result = [ nelderMead_output . x [ 0 ] , nelderMead_output . x [ 1 ] ]
81
79
let new_loss = loss ( new_result )
82
80
83
- if ( new_loss < target_loss ) {
84
- console . log ( new_loss )
81
+ if ( loss < 10e-8 ) {
85
82
return new_result
86
83
}
87
84
@@ -91,8 +88,7 @@ export const find_beta_from_ci = ({ci_lower, ci_upper, ci_length}) => {
91
88
}
92
89
}
93
90
}
94
- console . log ( `Initial grid loss: ${ loss_init } ` )
95
- if ( min_loss < target_loss ) {
91
+ if ( loss < 10e-6 ) {
96
92
return result
97
93
}
98
94
@@ -106,8 +102,7 @@ export const find_beta_from_ci = ({ci_lower, ci_upper, ci_length}) => {
106
102
let new_result = [ nelderMead_output . x [ 0 ] , nelderMead_output . x [ 1 ] ]
107
103
let new_loss = loss ( new_result )
108
104
109
- if ( new_loss < target_loss ) {
110
- console . log ( new_loss )
105
+ if ( loss < 10e-8 ) {
111
106
return new_result
112
107
}
113
108
0 commit comments