python numpy std vs scala breeze stddev2019 Community Moderator ElectionScala: What is the generic way to calculate standard deviationCalling an external command in PythonWhat are metaclasses in Python?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?How to get the current time in PythonHow can I make a time delay in Python?How to make a flat list out of list of lists?Does Python have a string 'contains' substring method?
An Undercover Army
3.5% Interest Student Loan or use all of my savings on Tuition?
How to write a chaotic neutral protagonist and prevent my readers from thinking they are evil?
Issue with units for a rocket nozzle throat area problem
I've given my players a lot of magic items. Is it reasonable for me to give them harder encounters?
What exactly is the meaning of "fine wine"?
Limpar string com Regex
A vote on the Brexit backstop
Precision notation for voltmeters
Propulsion Systems
Sort array by month and year
Can the Witch Sight warlock invocation see through the Mirror Image spell?
Does the US political system, in principle, allow for a no-party system?
What is the oldest European royal house?
Is the differential, dp, exact or not?
How to distinguish easily different soldier of ww2?
After Brexit, will the EU recognize British passports that are valid for more than ten years?
Why isn't P and P/poly trivially the same?
Is "cogitate" used appropriately in "I cogitate that success relies on hard work"?
Is divide-by-zero a security vulnerability?
What should I do when a paper is published similar to my PhD thesis without citation?
What does *dead* mean in *What do you mean, dead?*?
What would be the most expensive material to an intergalactic society?
Are small insurances worth it?
python numpy std vs scala breeze stddev
2019 Community Moderator ElectionScala: What is the generic way to calculate standard deviationCalling an external command in PythonWhat are metaclasses in Python?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonHow can I safely create a nested directory in Python?Does Python have a ternary conditional operator?How to get the current time in PythonHow can I make a time delay in Python?How to make a flat list out of list of lists?Does Python have a string 'contains' substring method?
I'm currently working on migrating some python code to scala. I'm using breeze lib as a substitution for numpy.
Everything looks fine, but I faced different behaviour in output of standard deviation implementations:
Python:
series = np.array([1,4,5])
np.mean(series) // 3.3333333333333335
np.std(series) // 1.699673171197595
Scala:
val vector = breeze.linalg.Vector[Double](Array(1.0, 4.0, 5.0))
val mean = breeze.stats.mean(vector) // 3.3333333333333335
val std = breeze.stats.stddev(vector) // 2.081665999466133
I know how to reproduce python's behaviour in plain scala. Sample code is presented here: Scala: What is the generic way to calculate standard deviation
But I'm looking for a way to get it with breeze. Any ideas?
python scala scala-breeze
add a comment |
I'm currently working on migrating some python code to scala. I'm using breeze lib as a substitution for numpy.
Everything looks fine, but I faced different behaviour in output of standard deviation implementations:
Python:
series = np.array([1,4,5])
np.mean(series) // 3.3333333333333335
np.std(series) // 1.699673171197595
Scala:
val vector = breeze.linalg.Vector[Double](Array(1.0, 4.0, 5.0))
val mean = breeze.stats.mean(vector) // 3.3333333333333335
val std = breeze.stats.stddev(vector) // 2.081665999466133
I know how to reproduce python's behaviour in plain scala. Sample code is presented here: Scala: What is the generic way to calculate standard deviation
But I'm looking for a way to get it with breeze. Any ideas?
python scala scala-breeze
add a comment |
I'm currently working on migrating some python code to scala. I'm using breeze lib as a substitution for numpy.
Everything looks fine, but I faced different behaviour in output of standard deviation implementations:
Python:
series = np.array([1,4,5])
np.mean(series) // 3.3333333333333335
np.std(series) // 1.699673171197595
Scala:
val vector = breeze.linalg.Vector[Double](Array(1.0, 4.0, 5.0))
val mean = breeze.stats.mean(vector) // 3.3333333333333335
val std = breeze.stats.stddev(vector) // 2.081665999466133
I know how to reproduce python's behaviour in plain scala. Sample code is presented here: Scala: What is the generic way to calculate standard deviation
But I'm looking for a way to get it with breeze. Any ideas?
python scala scala-breeze
I'm currently working on migrating some python code to scala. I'm using breeze lib as a substitution for numpy.
Everything looks fine, but I faced different behaviour in output of standard deviation implementations:
Python:
series = np.array([1,4,5])
np.mean(series) // 3.3333333333333335
np.std(series) // 1.699673171197595
Scala:
val vector = breeze.linalg.Vector[Double](Array(1.0, 4.0, 5.0))
val mean = breeze.stats.mean(vector) // 3.3333333333333335
val std = breeze.stats.stddev(vector) // 2.081665999466133
I know how to reproduce python's behaviour in plain scala. Sample code is presented here: Scala: What is the generic way to calculate standard deviation
But I'm looking for a way to get it with breeze. Any ideas?
python scala scala-breeze
python scala scala-breeze
edited Oct 17 '18 at 13:46
martineau
68.8k1091185
68.8k1091185
asked Oct 17 '18 at 13:24
NormalNormal
5461423
5461423
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
This is related to the number of degrees of freedom. Indeed,
>>> np.std(series, ddof=1)
2.081665999466133
Which is the sample std. With breeze, something you can do to get the population std is
var n = 3
val std = breeze.stats.stddev(vector)*Math.pow((n-1)/n, .5)
# 1.6996731711975948
Thanks for explanation. I've found related issue in breeze GitHub page: github.com/scalanlp/breeze/issues/507
– Normal
Oct 17 '18 at 13:40
@Normal This may be something you know but see my update regarding how to deal with this issue.
– keepAlive
Oct 17 '18 at 14:01
1
works for me, thanks!
– Normal
Oct 17 '18 at 14:26
add a comment |
If keepAlive's solution don't work, you should change "n" to Double
var n : Double = 3
val std = breeze.stats.stddev(vector)*Math.pow((n-1)/n, .5)
# 1.6996731711975948
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52856011%2fpython-numpy-std-vs-scala-breeze-stddev%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
This is related to the number of degrees of freedom. Indeed,
>>> np.std(series, ddof=1)
2.081665999466133
Which is the sample std. With breeze, something you can do to get the population std is
var n = 3
val std = breeze.stats.stddev(vector)*Math.pow((n-1)/n, .5)
# 1.6996731711975948
Thanks for explanation. I've found related issue in breeze GitHub page: github.com/scalanlp/breeze/issues/507
– Normal
Oct 17 '18 at 13:40
@Normal This may be something you know but see my update regarding how to deal with this issue.
– keepAlive
Oct 17 '18 at 14:01
1
works for me, thanks!
– Normal
Oct 17 '18 at 14:26
add a comment |
This is related to the number of degrees of freedom. Indeed,
>>> np.std(series, ddof=1)
2.081665999466133
Which is the sample std. With breeze, something you can do to get the population std is
var n = 3
val std = breeze.stats.stddev(vector)*Math.pow((n-1)/n, .5)
# 1.6996731711975948
Thanks for explanation. I've found related issue in breeze GitHub page: github.com/scalanlp/breeze/issues/507
– Normal
Oct 17 '18 at 13:40
@Normal This may be something you know but see my update regarding how to deal with this issue.
– keepAlive
Oct 17 '18 at 14:01
1
works for me, thanks!
– Normal
Oct 17 '18 at 14:26
add a comment |
This is related to the number of degrees of freedom. Indeed,
>>> np.std(series, ddof=1)
2.081665999466133
Which is the sample std. With breeze, something you can do to get the population std is
var n = 3
val std = breeze.stats.stddev(vector)*Math.pow((n-1)/n, .5)
# 1.6996731711975948
This is related to the number of degrees of freedom. Indeed,
>>> np.std(series, ddof=1)
2.081665999466133
Which is the sample std. With breeze, something you can do to get the population std is
var n = 3
val std = breeze.stats.stddev(vector)*Math.pow((n-1)/n, .5)
# 1.6996731711975948
edited Oct 17 '18 at 13:45
answered Oct 17 '18 at 13:30
keepAlivekeepAlive
3,18541224
3,18541224
Thanks for explanation. I've found related issue in breeze GitHub page: github.com/scalanlp/breeze/issues/507
– Normal
Oct 17 '18 at 13:40
@Normal This may be something you know but see my update regarding how to deal with this issue.
– keepAlive
Oct 17 '18 at 14:01
1
works for me, thanks!
– Normal
Oct 17 '18 at 14:26
add a comment |
Thanks for explanation. I've found related issue in breeze GitHub page: github.com/scalanlp/breeze/issues/507
– Normal
Oct 17 '18 at 13:40
@Normal This may be something you know but see my update regarding how to deal with this issue.
– keepAlive
Oct 17 '18 at 14:01
1
works for me, thanks!
– Normal
Oct 17 '18 at 14:26
Thanks for explanation. I've found related issue in breeze GitHub page: github.com/scalanlp/breeze/issues/507
– Normal
Oct 17 '18 at 13:40
Thanks for explanation. I've found related issue in breeze GitHub page: github.com/scalanlp/breeze/issues/507
– Normal
Oct 17 '18 at 13:40
@Normal This may be something you know but see my update regarding how to deal with this issue.
– keepAlive
Oct 17 '18 at 14:01
@Normal This may be something you know but see my update regarding how to deal with this issue.
– keepAlive
Oct 17 '18 at 14:01
1
1
works for me, thanks!
– Normal
Oct 17 '18 at 14:26
works for me, thanks!
– Normal
Oct 17 '18 at 14:26
add a comment |
If keepAlive's solution don't work, you should change "n" to Double
var n : Double = 3
val std = breeze.stats.stddev(vector)*Math.pow((n-1)/n, .5)
# 1.6996731711975948
add a comment |
If keepAlive's solution don't work, you should change "n" to Double
var n : Double = 3
val std = breeze.stats.stddev(vector)*Math.pow((n-1)/n, .5)
# 1.6996731711975948
add a comment |
If keepAlive's solution don't work, you should change "n" to Double
var n : Double = 3
val std = breeze.stats.stddev(vector)*Math.pow((n-1)/n, .5)
# 1.6996731711975948
If keepAlive's solution don't work, you should change "n" to Double
var n : Double = 3
val std = breeze.stats.stddev(vector)*Math.pow((n-1)/n, .5)
# 1.6996731711975948
answered 2 days ago
Pablo López GallegoPablo López Gallego
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52856011%2fpython-numpy-std-vs-scala-breeze-stddev%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown