dpraz commited on
Commit
b8a4f6a
1 Parent(s): 6dd9bb0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -451,39 +451,39 @@ def twoD_regs(CC_reg,NC_reg,x_vals,y_vals,z_vals,plotting_df,CC_check,NC_check):
451
  CC_m1,CC_m2,CC_m3,CC_b1,CC_b2,CC_b3,NC_m1,NC_m2,NC_m3,NC_b1,NC_b2,NC_b3 = 1,1,1,1,1,1,1,1,1,1,1,1
452
 
453
  model.fit(cc_xx,cc_temp_xy[y_vals].to_numpy())
454
- cc_r1=model.score(cc_xx,cc_temp_xy[y_vals].to_numpy()).round(5)
455
  cc_xy2=model.predict(cc_xy1)
456
  CC_m1=model.coef_
457
  CC_b1=model.intercept_
458
  trace1 = go.Scatter(x=np.ravel(cc_xy1),y=np.ravel(cc_xy2),mode='lines',line=dict(color='blue'),showlegend=False,hoverinfo='text',hovertext=f'CC Regression<br>correl. coeff. (r<sup>2</sup>): {cc_r1}<br>slope: {CC_m1.round(4)}<br>y-axis intercept: {CC_b1.round(4)}')
459
  model.fit(nc_xx,nc_temp_xy[y_vals].to_numpy())
460
- nc_r1=model.score(nc_xx,nc_temp_xy[y_vals].to_numpy()).round(5)
461
  nc_xy2=model.predict(nc_xy1)
462
  NC_m1=model.coef_
463
  NC_b1=model.intercept_
464
  trace1a = go.Scatter(x=np.ravel(nc_xy1),y=np.ravel(nc_xy2),mode='lines',line=dict(color='red'),showlegend=False,hoverinfo='text',hovertext=f'NC Regression<br>correl. coeff. (r<sup>2</sup>): {nc_r1}<br>slope: {NC_m1.round(4)}<br>y-axis intercept: {NC_b1.round(4)}')
465
 
466
  model.fit(cc_yy,cc_temp_yz[z_vals].to_numpy())
467
- cc_r2=model.score(cc_yy,cc_temp_yz[z_vals].to_numpy()).round(5)
468
  cc_yz2=model.predict(cc_yz1)
469
  CC_m2=model.coef_
470
  CC_b2=model.intercept_
471
  trace2 = go.Scatter(x=np.ravel(cc_yz1),y=np.ravel(cc_yz2),mode='lines',line=dict(color='blue'),showlegend=False,hoverinfo='text',hovertext=f'CC Regression<br>correl. coeff. (r<sup>2</sup>): {cc_r2}<br>slope: {CC_m2.round(4)}<br>y-axis intercept: {CC_b2.round(4)}')
472
  model.fit(nc_yy,nc_temp_yz[z_vals].to_numpy())
473
- nc_r2=model.score(nc_yy,nc_temp_yz[z_vals].to_numpy()).round(5)
474
  nc_yz2=model.predict(nc_yz1)
475
  NC_m2=model.coef_
476
  NC_b2=model.intercept_
477
  trace2a = go.Scatter(x=np.ravel(nc_yz1),y=np.ravel(nc_yz2),mode='lines',line=dict(color='red'),showlegend=False,hoverinfo='text',hovertext=f'NC Regression<br>correl. coeff. (r<sup>2</sup>): {nc_r2}<br>slope: {NC_m2.round(4)}<br>y-axis intercept: {NC_b2.round(4)}')
478
 
479
  model.fit(cc_zz,cc_temp_zx[x_vals].to_numpy())
480
- cc_r3=model.score(cc_zz,cc_temp_zx[x_vals].to_numpy()).round(5)
481
  cc_zx2=model.predict(cc_zx1)
482
  CC_m3=model.coef_
483
  CC_b3=model.intercept_
484
  trace3 = go.Scatter(x=np.ravel(cc_zx1),y=np.ravel(cc_zx2),mode='lines',line=dict(color='blue'),showlegend=False,hoverinfo='text',hovertext=f'CC Regression<br>correl. coeff. (r<sup>2</sup>): {cc_r3}<br>slope: {CC_m3.round(4)}<br>y-axis intercept: {CC_b3.round(4)}')
485
  model.fit(nc_zz,nc_temp_zx[x_vals].to_numpy())
486
- nc_r3=model.score(nc_zz,nc_temp_zx[x_vals].to_numpy()).round(5)
487
  nc_zx2=model.predict(nc_zx1)
488
  NC_m3=model.coef_
489
  NC_b3=model.intercept_
@@ -741,4 +741,4 @@ with gr.Blocks() as demo:
741
  NC_reg.input(fn=twoD_regs,inputs=[CC_reg,NC_reg,x_vals,y_vals,z_vals,plotting_df,CC_check,NC_check], outputs=[twoD_1,twoD_2,twoD_3,reg_df,update_reg_btn,fig01,fig02,fig03,fig_exports]).success(fn=plot_3D_reg,inputs=[plotting_df,reg_df,x_vals, y_vals, z_vals,CC_reg,NC_reg],outputs=[threeD,update_reg_btn])
742
 
743
  update_reg_btn.click(fn=plot_3D_reg,inputs=[plotting_df,reg_df,x_vals, y_vals, z_vals,CC_reg,NC_reg],outputs=[threeD,update_reg_btn])
744
- demo.launch(debug=True)
 
451
  CC_m1,CC_m2,CC_m3,CC_b1,CC_b2,CC_b3,NC_m1,NC_m2,NC_m3,NC_b1,NC_b2,NC_b3 = 1,1,1,1,1,1,1,1,1,1,1,1
452
 
453
  model.fit(cc_xx,cc_temp_xy[y_vals].to_numpy())
454
+ cc_r1 = round(model.score(cc_xx, cc_temp_xy[y_vals].to_numpy()), 5)
455
  cc_xy2=model.predict(cc_xy1)
456
  CC_m1=model.coef_
457
  CC_b1=model.intercept_
458
  trace1 = go.Scatter(x=np.ravel(cc_xy1),y=np.ravel(cc_xy2),mode='lines',line=dict(color='blue'),showlegend=False,hoverinfo='text',hovertext=f'CC Regression<br>correl. coeff. (r<sup>2</sup>): {cc_r1}<br>slope: {CC_m1.round(4)}<br>y-axis intercept: {CC_b1.round(4)}')
459
  model.fit(nc_xx,nc_temp_xy[y_vals].to_numpy())
460
+ nc_r1= round(model.score(nc_xx,nc_temp_xy[y_vals].to_numpy()),5)
461
  nc_xy2=model.predict(nc_xy1)
462
  NC_m1=model.coef_
463
  NC_b1=model.intercept_
464
  trace1a = go.Scatter(x=np.ravel(nc_xy1),y=np.ravel(nc_xy2),mode='lines',line=dict(color='red'),showlegend=False,hoverinfo='text',hovertext=f'NC Regression<br>correl. coeff. (r<sup>2</sup>): {nc_r1}<br>slope: {NC_m1.round(4)}<br>y-axis intercept: {NC_b1.round(4)}')
465
 
466
  model.fit(cc_yy,cc_temp_yz[z_vals].to_numpy())
467
+ cc_r2=round(model.score(cc_yy,cc_temp_yz[z_vals].to_numpy()),5)
468
  cc_yz2=model.predict(cc_yz1)
469
  CC_m2=model.coef_
470
  CC_b2=model.intercept_
471
  trace2 = go.Scatter(x=np.ravel(cc_yz1),y=np.ravel(cc_yz2),mode='lines',line=dict(color='blue'),showlegend=False,hoverinfo='text',hovertext=f'CC Regression<br>correl. coeff. (r<sup>2</sup>): {cc_r2}<br>slope: {CC_m2.round(4)}<br>y-axis intercept: {CC_b2.round(4)}')
472
  model.fit(nc_yy,nc_temp_yz[z_vals].to_numpy())
473
+ nc_r2=round(model.score(nc_yy,nc_temp_yz[z_vals].to_numpy()),5)
474
  nc_yz2=model.predict(nc_yz1)
475
  NC_m2=model.coef_
476
  NC_b2=model.intercept_
477
  trace2a = go.Scatter(x=np.ravel(nc_yz1),y=np.ravel(nc_yz2),mode='lines',line=dict(color='red'),showlegend=False,hoverinfo='text',hovertext=f'NC Regression<br>correl. coeff. (r<sup>2</sup>): {nc_r2}<br>slope: {NC_m2.round(4)}<br>y-axis intercept: {NC_b2.round(4)}')
478
 
479
  model.fit(cc_zz,cc_temp_zx[x_vals].to_numpy())
480
+ cc_r3=round(model.score(cc_zz,cc_temp_zx[x_vals].to_numpy()),5)
481
  cc_zx2=model.predict(cc_zx1)
482
  CC_m3=model.coef_
483
  CC_b3=model.intercept_
484
  trace3 = go.Scatter(x=np.ravel(cc_zx1),y=np.ravel(cc_zx2),mode='lines',line=dict(color='blue'),showlegend=False,hoverinfo='text',hovertext=f'CC Regression<br>correl. coeff. (r<sup>2</sup>): {cc_r3}<br>slope: {CC_m3.round(4)}<br>y-axis intercept: {CC_b3.round(4)}')
485
  model.fit(nc_zz,nc_temp_zx[x_vals].to_numpy())
486
+ nc_r3=round(model.score(nc_zz,nc_temp_zx[x_vals].to_numpy()),5)
487
  nc_zx2=model.predict(nc_zx1)
488
  NC_m3=model.coef_
489
  NC_b3=model.intercept_
 
741
  NC_reg.input(fn=twoD_regs,inputs=[CC_reg,NC_reg,x_vals,y_vals,z_vals,plotting_df,CC_check,NC_check], outputs=[twoD_1,twoD_2,twoD_3,reg_df,update_reg_btn,fig01,fig02,fig03,fig_exports]).success(fn=plot_3D_reg,inputs=[plotting_df,reg_df,x_vals, y_vals, z_vals,CC_reg,NC_reg],outputs=[threeD,update_reg_btn])
742
 
743
  update_reg_btn.click(fn=plot_3D_reg,inputs=[plotting_df,reg_df,x_vals, y_vals, z_vals,CC_reg,NC_reg],outputs=[threeD,update_reg_btn])
744
+ demo.launch(debug=True)