git.delta.rocks / unique-network / refs/commits / 96adb0a47e0b

difftreelog

fix(calibrate) hide error value

Yaroslav Bolyukin2022-12-19parent: #0058f26.patch.diff
in: master

1 file changed

modifiedtests/src/calibrate.tsdiffbeforeafterboth
174174
175const hypothesisLinear = (a: Fract, b: Fract) => (x: Fract) => rpn(x, a, '*', b, '+');175const hypothesisLinear = (a: Fract, b: Fract) => (x: Fract) => rpn(x, a, '*', b, '+');
176176
177function error(points: { x: Fract, y: Fract }[], hypothesis: (a: Fract) => Fract) {177function _error(points: { x: Fract, y: Fract }[], hypothesis: (a: Fract) => Fract) {
178 return points.map(p => {178 return points.map(p => {
179 const v = hypothesis(p.x);179 const v = hypothesis(p.x);
180 const vv = p.y;180 const vv = p.y;
218 const {a, b} = linearRegression(dataPoints);218 const {a, b} = linearRegression(dataPoints);
219219
220 const hyp = hypothesisLinear(a, b);220 const hyp = hypothesisLinear(a, b);
221 console.log(`\t[NFT transfer] Error: ${error(dataPoints, hyp).toNumber()}`);221 // console.log(`\t[NFT transfer] Error: ${_error(dataPoints, hyp).toNumber()}`);
222222
223 // 0.1 UNQ223 // 0.1 UNQ
224 const perfectValue = hyp(rpn(new Fract(helper.balance.getOneTokenNominal()), new Fract(1n, 10n), '*'));224 const perfectValue = hyp(rpn(new Fract(helper.balance.getOneTokenNominal()), new Fract(1n, 10n), '*'));
276 const {a, b} = linearRegression(dataPoints);276 const {a, b} = linearRegression(dataPoints);
277277
278 const hyp = hypothesisLinear(a, b);278 const hyp = hypothesisLinear(a, b);
279 console.log(`\t[ETH NFT transfer] Error: ${error(dataPoints, hyp).toNumber()}`);279 // console.log(`\t[ETH NFT transfer] Error: ${_error(dataPoints, hyp).toNumber()}`);
280280
281 // 0.15 UNQ281 // 0.15 UNQ
282 const perfectValue = hyp(rpn(new Fract(helper.balance.getOneTokenNominal()), new Fract(15n, 100n), '*'));282 const perfectValue = hyp(rpn(new Fract(helper.balance.getOneTokenNominal()), new Fract(15n, 100n), '*'));