Tag: r

55 votes
2 answers
2.6K views
Two-sample Kolmogorov-Smirnov Test in Python Scipy

I can't figure out how to do a Two-sample KS test in Scipy. After reading the documentation scipy kstest

avatar
Chelsea
0 1 0 9
asked 07 September, 2021
58 votes
4 answers
2.7K views
How to transform numpy.matrix or array to scipy sparse matrix

For SciPy sparse matrix, one can use todense() or toarray() to transform to NumPy matrix or array. What are th

avatar
Patsy
0 1 0 9
asked 07 September, 2021
62 votes
13 answers
1.2K views
ImportError: No module named scipy

I am using Python 2.7 and trying to get PyBrain to work. But I get this error even though scipy is installed

avatar
Eddie
0 1 0 9
asked 07 September, 2021
63 votes
9 answers
631 views
How to calculate probability in a normal distribution given mean & standard deviation?

How to calculate probability in normal distribution given mean, std in Python? I can always explicitly code my

avatar
Forrest
0 1 0 9
asked 07 September, 2021
48 votes
7 answers
1K views
Histogram Matplotlib

So I have a little problem. I have a data set in scipy that is already in the histogram format, so I have the

avatar
Renaldo
0 1 0 9
asked 07 September, 2021
55 votes
1 answers
346 views
How can I perform two-dimensional interpolation using scipy?

This Q&A is intended as a canonical(-ish) concerning two-dimensional (and multi-dimensional) interpolatio

avatar
Roger
0 1 0 9
asked 07 September, 2021
61 votes
13 answers
535 views
ImportError in importing from sklearn: cannot import name check_build

I am getting the following error while trying to import from sklearn: >>> from sklearn import svm T

avatar
Alphonso
0 1 0 9
asked 07 September, 2021
56 votes
9 answers
698 views
Numpy Resize/Rescale Image

I would like to take an image and change the scale of the image, while it is a numpy array. For example I hav

avatar
Tuan
0 1 0 9
asked 07 September, 2021
57 votes
6 answers
2.3K views
How to create a density plot in matplotlib?

In R I can create the desired output by doing: data = c(rep(1.5, 7), rep(2.5, 2), rep(3.5, 8), rep(

avatar
Kristopher
0 1 0 9
asked 07 September, 2021
56 votes
14 answers
1.5K views
Multiple linear regression in Python

I can't seem to find any python libraries that do multiple regression. The only things I find only do sim

avatar
Jeff
0 1 0 9
asked 07 September, 2021
57 votes
6 answers
1.4K views
Numpy: Divide each row by a vector element

Suppose I have a numpy array: data = np.array([[1,1,1],[2,2,2],[3,3,3]]) and I have a corresponding "vector

avatar
Charis
0 1 0 9
asked 07 September, 2021
51 votes
5 answers
1K views
Compute a confidence interval from sample data

I have sample data which I would like to compute a confidence interval for, assuming a normal distribution. I

avatar
Charis
0 1 0 9
asked 07 September, 2021
57 votes
16 answers
1.6K views
scipy.misc module has no attribute imread?

I am trying to read an image with scipy. However it does not accept the scipy.misc.imread part. What could be

avatar
Basil
0 1 0 9
asked 07 September, 2021
57 votes
9 answers
1.7K views
Peak-finding algorithm for Python/SciPy

I can write something myself by finding zero-crossings of the first derivative or something, but it seems like

avatar
Xavier
0 1 0 9
asked 07 September, 2021
61 votes
10 answers
962 views
Fitting empirical distribution to theoretical ones with Scipy (Python)?

INTRODUCTION: I have a list of more than 30,000 integer values ranging from 0 to 47, inclusive, e.g.[0,0,0,0,.

avatar
Renaldo
0 1 0 9
asked 07 September, 2021
55 votes
8 answers
2.6K views
How to normalize a NumPy array to within a certain range?

After doing some processing on an audio or image array, it needs to be normalized within a range before it can

avatar
Basil
0 1 0 9
asked 07 September, 2021
43 votes
7 answers
2.6K views
How to do exponential and logarithmic curve fitting in Python? I found only polynomial fitting

I have a set of data and I want to compare which line describes it best (polynomials of different orders, expo

avatar
Luis
0 1 0 9
asked 07 September, 2021
54 votes
11 answers
1.5K views
Is there a library function for Root mean square error (RMSE) in python?

I know I could implement a root mean squared error function like this: def rmse(predictions, targets): re

avatar
Carmelina
0 1 0 9
asked 07 September, 2021
56 votes
28 answers
1.7K views
Moving average or running mean

Is there a SciPy function or NumPy function or module for Python that calculates the running mean of a 1D arra

avatar
Yolando
0 1 0 9
asked 07 September, 2021
62 votes
10 answers
2.7K views
How to smooth a curve in the right way?

Lets assume we have a dataset which might be given approximately by import numpy as np x = np.linspace(0,2*np

avatar
Bryan
0 1 0 9
asked 07 September, 2021