Ho utilizzato una trasformazione BoxCox per migliorare l'accuratezza della mia regressione lineare multipla. Ho trasferito le mie formule da JMP a Excel usando Python. Ho riscontrato problemi nel comprendere come JMP esegua le trasformazioni BoxCox. Quando eseguo il calcolo manualmente o quando lo trasferisco in Python e poi in Excel, ottengo numeri che sono enormemente imprecisi o impossibili. Come esegue JMP BoxCox e c'è qualcosa che non va nell'esportazione delle formule in Python? Ho allegato il codice di esportazione Python di JMP qui sotto. Quando lo calcolo manualmente ottengo un numero nell'ordine dei milioni, ma quando uso la formula predetta salvata in colonna ottengo un numero corretto nell'ordine delle centinaia di migliaia. Qualsiasi aiuto o suggerimento su come JMP esegue BoxCox sarà apprezzato! JMP Pro 18.
def getModelMetadata():
return {"creator": u"Fit Least Squares", "modelName": u"", "predicted": u"BoxCox(Sold Price Adjusted,-0.3)", "table": u"Nation 5", "version": u"18.0.2", "timestamp": u"2025-06-30T15:25:18Z"}
def getInputMetadata():
return {
u"Acres": "float",
u"Approx Living Area": "float",
u"Baths Total": "float",
u"Beds Total": "float",
u"DSS": "float",
u"Garage Spaces": "float",
u"Private Pool YN": "float",
u"Quality": "float",
u"Roof Type": "str",
u"View Type": "str",
u"YSB": "float",
u"Zip Code": "str"
}
def getOutputMetadata():
return {
u"Pred Formula BoxCox(Sold Price Adjusted,-0.3)": "float"
}
def score(indata, outdata):
outdata[u"Pred Formula BoxCox(Sold Price Adjusted,-0.3)"] = 61472780.2409559 + 60581.3260155158 * indata[u"Acres"] + 76.038924975424 * indata[u"Approx Living Area"] + 1434.15365470938 * indata[u"Baths Total"] + 9999.1641409011 * indata[u"Beds Total"] + 86.4673966716914 * indata[u"DSS"] + -15193.2763707411 * indata[u"Garage Spaces"] + -4868.56832700296 * indata[u"YSB"] + -0.000111820060662331 * jmp_score.pow(max((-2377.5 + indata[u"Approx Living Area"]), 0), 3) + 0.000218413512113602 * jmp_score.pow(max((-2084.375 + indata[u"Approx Living Area"]), 0), 3) + -0.0000481979741763377 * jmp_score.pow(max((-1791.25 + indata[u"Approx Living Area"]), 0), 3) + -0.000111564345338805 * jmp_score.pow(max((-1498.125 + indata[u"Approx Living Area"]), 0), 3) + 0.0000531688680638719 * jmp_score.pow(max((-1205 + indata[u"Approx Living Area"]), 0), 3) + 0.0000360479302007263 * jmp_score.pow(max((-720 + indata[u"DSS"]), 0), 3) + -0.000303707412501711 * jmp_score.pow(max((-548.375 + indata[u"DSS"]), 0), 3) + 0.000574533492998107 * jmp_score.pow(max((-376.75 + indata[u"DSS"]), 0), 3) + -0.000382136469293987 * jmp_score.pow(max((-205.125 + indata[u"DSS"]), 0), 3) + 2.0848630376972 * jmp_score.pow(max((-54 + indata[u"YSB"]), 0), 3) + -6.78318277799419 * jmp_score.pow(max((-40.75 + indata[u"YSB"]), 0), 3) + 0.0000752624585968641 * jmp_score.pow(max((-33.5 + indata[u"DSS"]), 0), 3) + 11.8037791782328 * jmp_score.pow(max((-27.5 + indata[u"YSB"]), 0), 3) + -11.5974621732718 * jmp_score.pow(max((-14.25 + indata[u"YSB"]), 0), 3) + 34307.817288351 * jmp_score.pow(max((-4 + indata[u"Beds Total"]), 0), 3) + -82471.0545165041 * jmp_score.pow(max((-3.75 + indata[u"Beds Total"]), 0), 3) + 110181.894396108 * jmp_score.pow(max((-3.25 + indata[u"Beds Total"]), 0), 3) + 50990.021304843 * jmp_score.pow(max((-3 + indata[u"Baths Total"]), 0), 3) + -62018.6571679552 * jmp_score.pow(max((-3 + indata[u"Beds Total"]), 0), 3) + 6900.66685733204 * jmp_score.pow(max((-3 + indata[u"Garage Spaces"]), 0), 3) + -203976.475578522 * jmp_score.pow(max((-2.75 + indata[u"Baths Total"]), 0), 3) + 379069.565502919 * jmp_score.pow(max((-2.5 + indata[u"Baths Total"]), 0), 3) + -1826.25048644381 * jmp_score.pow(max((-2.5 + indata[u"Garage Spaces"]), 0), 3) + -350169.789489644 * jmp_score.pow(max((-2.25 + indata[u"Baths Total"]), 0), 3) + 124086.678260404 * jmp_score.pow(max((-2 + indata[u"Baths Total"]), 0), 3) + -22123.9159699968 * jmp_score.pow(max((-1.5 + indata[u"Garage Spaces"]), 0), 3) + 17049.4995991085 * jmp_score.pow(max((-1 + indata[u"Garage Spaces"]), 0), 3) + 4.49200273533602 * jmp_score.pow(max((-1 + indata[u"YSB"]), 0), 3) + -12639560.8157951 * jmp_score.pow(max((-0.344 + indata[u"Acres"]), 0), 3) + 74925794.6112123 * jmp_score.pow(max((-0.3155 + indata[u"Acres"]), 0), 3) + -141292074.998634 * jmp_score.pow(max((-0.287 + indata[u"Acres"]), 0), 3) + 108365009.426811 * jmp_score.pow(max((-0.2585 + indata[u"Acres"]), 0), 3) + -29359168.2235941 * jmp_score.pow(max((-0.23 + indata[u"Acres"]), 0), 3) + jmp_score.match(indata[u"Private Pool YN"],{0:-43139.9442569903,1:43139.9442569903},np.nan) + jmp_score.match(indata[u"Quality"],{2:0,3:28579.9772799121,4:39613.8033512621,5:71535.0764862525},np.nan) + jmp_score.match(indata[u"View Type"],{u"Non-Waterfront":0,u"Canal":31836.2480827341,u"Intersecting":54959.261991344,u"Lake/Preserve":63588.822186035},np.nan) + jmp_score.match(indata[u"Roof Type"],{u"Metal":8097.08472648753,u"Other":-29355.9769453505,u"Shingle":-6973.70830694782,u"Slate":9777.74525204555,u"Tile":18454.8552737652},np.nan) + jmp_score.match(indata[u"Zip Code"],{u"33904":3787.58841702505,u"33909":-9286.21790641882,u"33914":11250.3301884419,u"33990":-1959.26139032746,u"33991":-3792.43930872063},np.nan)
return outdata[u"Pred Formula BoxCox(Sold Price Adjusted,-0.3)"]