Win a copy of Mastering Corda: Blockchain for Java Developers this week in the Cloud/Virtualization forum!

Jaakko Seppälä

+ Follow
since Nov 08, 2020
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jaakko Seppälä

I think the following will do the job:

2 weeks ago
I mean that it would be nice to see what kind of regression models the data a good way, and what are the coefficients of such a model. If this is too hard, it is sufficient to find real numbers a and b such that e^(a+bx) fits to the data the best way is sense of ordinary least squares approximation. I try to learn how to implement regression and matrix algebra to JavaScript.
2 weeks ago
In JavaScript, how can I do regression estimates from data? I mean, I have data of the form
1960: 200000
1970: 400000
1980: 600000
1990: 1000000
2000: 1800000
2010: 3300000
My goal is to predict what is the value of 2020 if the growth remains the same. The problem was given as how a population of particular artificial country will grow so I am not sure if the exponential model describes the growth well enough.
2 weeks ago
Could anyone help me with the following exercise:

From you can see three Map data structures of shops: the name of the shop and prices of the shop. Make three functions that returns the following map: Map { 'ykauppa' => 26 }. The key is the name of the shop that sum of the items is the smallest, so we are looking the cheapest shop.

I have been given the following hints: 1) sum(shop) returns the sum of prices of the items in a shop (map.values()). 2) createSumMap(key, ...shops) creates and returns a new map that key-value pairs contains shops and the sum of items.

3) minValueMap(mapX) -function creates the map from previous map. One can use for example forEach.

I was given the following test file:

My effort was

But this returns an error:

What is my mistake? Do I have to implement also the function get? I thought that it is enough is the function returns a suitable map.
In JavaScript, how can I compute the sum of the numerical values of a map? Why do the following returns 0 instead of 35? In the exercise, the Map structure shop1 was given so the solution is supposed to do without modifying the lines where shop1 is constructed.