GUI and Desktop Applications
int64
0
1
A_Id
int64
5.3k
72.5M
Networking and APIs
int64
0
1
Python Basics and Environment
int64
0
1
Other
int64
0
1
Database and SQL
int64
0
1
Available Count
int64
1
13
is_accepted
bool
2 classes
Q_Score
int64
0
1.72k
CreationDate
stringlengths
23
23
Users Score
int64
-11
327
AnswerCount
int64
1
31
System Administration and DevOps
int64
0
1
Title
stringlengths
15
149
Q_Id
int64
5.14k
60M
Score
float64
-1
1.2
Tags
stringlengths
6
90
Answer
stringlengths
18
5.54k
Question
stringlengths
49
9.42k
Web Development
int64
0
1
Data Science and Machine Learning
int64
1
1
ViewCount
int64
7
3.27M
0
4,567,653
0
0
0
0
1
true
1
2010-12-29T19:12:00.000
0
1
1
Easiest non-Java way to write HBase MapReduce on CDH3?
4,557,045
1.2
python,hadoop,mapreduce,hbase
It's not precisely an answer, but it's the closest I got -- I asked in #hbase on irc.freenode.net yesterday, and one of the Cloudera employees responded. The "Input Splits" problem I'm having with Pig is specific to Pig 0.7, and Pig 0.8 will be bundled with Cloudera CDH3 Beta 4 (no ETA on that). Therefore, what I want ...
I've been working on this for a long time, and I feel very worn out; I'm hoping for an [obvious?] insight from SO community that might get my pet project back on the move, so I can stop kicking myself. I'm using Cloudera CDH3, HBase .89 and Hadoop .20. I have a Python/Django app that writes data to a single HBase table...
1
1
1,322
0
4,561,924
0
0
0
0
1
false
2
2010-12-30T06:36:00.000
4
2
0
Bell Curve Gaussian Algorithm (Python and/or C#)
4,560,554
0.379949
c#,python,algorithm
The important property of the bell curve is that it describes normal distribution, which is a simple model for many natural phenomena. I am not sure what kind of "normalization" you intend to do, but it seems to me that current score already complies with normal distribution, you just need to determine its properties (...
Here's a somewhat simplified example of what I am trying to do. Suppose I have a formula that computes credit points, but the formula has no constraints (for example, the score might be 1 to 5000). And a score is assigned to 100 people. Now, I want to assign a "normalized" score between 200 and 800 to each person, ba...
0
1
4,989
0
19,825,314
0
0
0
0
1
false
152
2011-01-07T11:22:00.000
27
12
0
Finding local maxima/minima with Numpy in a 1D numpy array
4,624,970
1
python,numpy
Another approach (more words, less code) that may help: The locations of local maxima and minima are also the locations of the zero crossings of the first derivative. It is generally much easier to find zero crossings than it is to directly find local maxima and minima. Unfortunately, the first derivative tends to "am...
Can you suggest a module function from numpy/scipy that can find local maxima/minima in a 1D numpy array? Obviously the simplest approach ever is to have a look at the nearest neighbours, but I would like to have an accepted solution that is part of the numpy distro.
0
1
290,777
0
4,630,743
0
1
0
0
2
false
1
2011-01-07T22:07:00.000
4
5
0
Using Python for quasi randomization
4,630,723
0.158649
python,random
To guarantee that there will be the same number of zeros and ones you can generate a list containing n/2 zeros and n/2 ones and shuffle it with random.shuffle. For small n, if you aren't happy that the result passes your acceptance criteria (e.g. not too many consecutive equal numbers), shuffle again. Be aware that doi...
Here's the problem: I try to randomize n times a choice between two elements (let's say [0,1] -> 0 or 1), and my final list will have n/2 [0] + n/2 [1]. I tend to have this kind of result: [0 1 0 0 0 1 0 1 1 1 1 1 1 0 0, until n]: the problem is that I don't want to have serially 4 or 5 times the same number so often. ...
0
1
588
0
4,630,745
0
1
0
0
2
false
1
2011-01-07T22:07:00.000
1
5
0
Using Python for quasi randomization
4,630,723
0.039979
python,random
Having 6 1's in a row isn't particularly improbable -- are you sure you're not getting what you want? There's a simple Python interface for a uniformly distributed random number, is that what you're looking for?
Here's the problem: I try to randomize n times a choice between two elements (let's say [0,1] -> 0 or 1), and my final list will have n/2 [0] + n/2 [1]. I tend to have this kind of result: [0 1 0 0 0 1 0 1 1 1 1 1 1 0 0, until n]: the problem is that I don't want to have serially 4 or 5 times the same number so often. ...
0
1
588
1
4,637,207
0
0
0
0
2
false
3
2011-01-09T01:31:00.000
0
3
0
Python Fast monochromatic bitmap
4,637,190
0
python,bitmap,performance
One thing I might suggest is using Python's built-in array class (http://docs.python.org/library/array.html), with a type of 'B'. Coding will be simplest if you use one byte per pixel, but if you want to save memory, you can pack 8 to a byte, and access using your own bit manipulation.
i want to implement 1024x1024 monochromatic grid , i need read data from any cell and insert rectangles with various dimensions, i have tried to make list in list ( and use it like 2d array ), what i have found is that list of booleans is slower than list of integers.... i have tried 1d list, and it was slower than 2d ...
0
1
651
1
4,637,284
0
0
0
0
2
false
3
2011-01-09T01:31:00.000
2
3
0
Python Fast monochromatic bitmap
4,637,190
0.132549
python,bitmap,performance
Raph's suggestin of using array is good, but it won't help on CPython, in fact I'd expect it to be 10-15% slower, however if you use it on PyPy (http://pypy.org/) I'd expect excellent results.
i want to implement 1024x1024 monochromatic grid , i need read data from any cell and insert rectangles with various dimensions, i have tried to make list in list ( and use it like 2d array ), what i have found is that list of booleans is slower than list of integers.... i have tried 1d list, and it was slower than 2d ...
0
1
651
0
4,880,177
0
0
0
0
1
false
16
2011-01-14T11:32:00.000
4
4
0
Is there a matplotlib flowable for ReportLab?
4,690,585
0.197375
python,matplotlib,reportlab
There is not one, but what I do in my own use of MatPlotLib with ReportLab is to generate PNGs and then embed the PNGs so that I don't need to also use PIL. However, if you do use PIL, I believe you should be able to generate and embed EPS using MatPlotLib and ReportLab.
I want to embed matplotlib charts into PDFs generated by ReportLab directly - i.e. not saving as a PNG first and then embedding the PNG into the PDF (i think I'll get better quality output). Does anyone know if there's a matplotlib flowable for ReportLab? Thanks
0
1
10,096
0
4,695,834
0
0
0
0
1
true
31
2011-01-14T19:58:00.000
7
3
0
expanding (adding a row or column) a scipy.sparse matrix
4,695,337
1.2
python,scipy,sparse-matrix
I don't think that there is any way to really escape from doing the copying. Both of those types of sparse matrices store their data as Numpy arrays (in the data and indices attributes for csr and in the data and rows attributes for lil) internally and Numpy arrays can't be extended. Update with more information: LIL d...
Suppose I have a NxN matrix M (lil_matrix or csr_matrix) from scipy.sparse, and I want to make it (N+1)xN where M_modified[i,j] = M[i,j] for 0 <= i < N (and all j) and M[N,j] = 0 for all j. Basically, I want to add a row of zeros to the bottom of M and preserve the remainder of the matrix. Is there a way to do this wit...
0
1
27,075
0
4,710,783
0
1
0
0
1
false
1,378
2011-01-15T16:10:00.000
2
17
0
How to put the legend outside the plot in Matplotlib
4,700,614
0.023525
python,matplotlib,legend
You can also try figlegend. It is possible to create a legend independent of any Axes object. However, you may need to create some "dummy" Paths to make sure the formatting for the objects gets passed on correctly.
I have a series of 20 plots (not subplots) to be made in a single figure. I want the legend to be outside of the box. At the same time, I do not want to change the axes, as the size of the figure gets reduced. Kindly help me for the following queries: I want to keep the legend box outside the plot area. (I want the...
0
1
1,360,273
0
4,758,849
0
0
0
0
3
false
8
2011-01-21T12:17:00.000
2
6
0
I want to use NumPy/SciPy. Should I use Python 2 or 3?
4,758,693
0.066568
python,numpy,python-3.x
I am quite conservative in this respect, and so I use Python 2.6. That's what comes pre-installed on my Linux box, and it is also the target version for the latest binary releases of SciPy. Python 3 is without a doubt a huge step forward, but if you do mainly numerical stuff with NumPy and SciPy, I'd still go for Pytho...
I am about to embark on some signal processing work using NumPy/SciPy. However, I have never used Python before and don't know where to start. I see there are currently two branches of Python in this world: Version 2.x and 3.x. Being a neophile, I instinctively tend to go for the newer one, but there seems to be a lot...
0
1
5,690
0
4,758,906
0
0
0
0
3
false
8
2011-01-21T12:17:00.000
2
6
0
I want to use NumPy/SciPy. Should I use Python 2 or 3?
4,758,693
0.066568
python,numpy,python-3.x
I can recommend Using py3k over py2.6 if possible. Especially if you're a new user, since some of the syntax changes in py3k and it'll be harder to get used the new syntax if you're starting out learning the old. The modules you mention all have support for py3k but as SilentGhost noted you might want to check for comp...
I am about to embark on some signal processing work using NumPy/SciPy. However, I have never used Python before and don't know where to start. I see there are currently two branches of Python in this world: Version 2.x and 3.x. Being a neophile, I instinctively tend to go for the newer one, but there seems to be a lot...
0
1
5,690
0
4,758,785
0
0
0
0
3
true
8
2011-01-21T12:17:00.000
3
6
0
I want to use NumPy/SciPy. Should I use Python 2 or 3?
4,758,693
1.2
python,numpy,python-3.x
Both scipy and numpy are compatible with py3k. However, if you'll need to plot stuff: matplotlib is not yet officially compatible with py3k. So, it'll depend on whether your signalling processing involves plotting. Syntactic differences are not that great between the two version.
I am about to embark on some signal processing work using NumPy/SciPy. However, I have never used Python before and don't know where to start. I see there are currently two branches of Python in this world: Version 2.x and 3.x. Being a neophile, I instinctively tend to go for the newer one, but there seems to be a lot...
0
1
5,690
0
4,759,549
0
0
1
0
3
false
21
2011-01-21T13:47:00.000
0
8
0
Java or Python for math?
4,759,485
0
java,python,math,stocks
What is more important for you? If it's rapid application development, I found Python significantly easier to code for than Java - and I was just learning Python, while I had been coding on Java for years. If it's application speed and the ability to reuse existing code, then you should probably stick with Java. It's r...
I'm trying to write a pretty heavy duty math-based project, which will parse through about 100MB+ data several times a day, so, I need a fast language that's pretty easy to use. I would have gone with C, but, getting a large project done in C is very difficult, especially with the low level programming getting in your ...
0
1
12,225
0
4,759,596
0
0
1
0
3
false
21
2011-01-21T13:47:00.000
1
8
0
Java or Python for math?
4,759,485
0.024995
java,python,math,stocks
If those are the choices, then Java should be the faster for math intensive work. It is compiled (although yes it is still running byte code). Exelian mentions NumPy. There's also the SciPy package. Both are worth looking at but only really seem to give speed improvements for work with lots of arrays and vector process...
I'm trying to write a pretty heavy duty math-based project, which will parse through about 100MB+ data several times a day, so, I need a fast language that's pretty easy to use. I would have gone with C, but, getting a large project done in C is very difficult, especially with the low level programming getting in your ...
0
1
12,225
0
4,765,700
0
0
1
0
3
false
21
2011-01-21T13:47:00.000
0
8
0
Java or Python for math?
4,759,485
0
java,python,math,stocks
The Apache Commons Math picked up where JAMA left off. They are quite capable for scientific computing. So is Python - NumPy and SciPy are excellent. I also like the fact that Python is a hybrid of object-orientation and functional programming. Functional programming is awfully handy for numerical methods. I'd rec...
I'm trying to write a pretty heavy duty math-based project, which will parse through about 100MB+ data several times a day, so, I need a fast language that's pretty easy to use. I would have gone with C, but, getting a large project done in C is very difficult, especially with the low level programming getting in your ...
0
1
12,225
0
52,617,040
0
0
0
0
3
false
0
2011-01-25T00:22:00.000
0
3
0
Unable to import matplotlib in PyDev
4,788,748
0
python,module,import,matplotlib,pydev
Right click your project, then go to properties, then click PyDev - Interpreter/Grammar, click "Click here to configure an interpreter not listed". Then select the interpreter you are using, click Install/Uninstall with pip, then enter matplotlib for . Then restart Eclipse and it should work.
I am using Ubuntu 10.04 and have successfully configured PyDev to work with Python and have written a few simple example projects. Now I am trying to incorporate numpy and matplotlib. I have gotten numpy installed and within PyDev I did not need to alter any paths, etc., and after the installation of numpy I was automa...
0
1
3,642
0
6,766,298
0
0
0
0
3
false
0
2011-01-25T00:22:00.000
1
3
0
Unable to import matplotlib in PyDev
4,788,748
0.066568
python,module,import,matplotlib,pydev
I added numpy to the Forced Builtins and worked like charm.
I am using Ubuntu 10.04 and have successfully configured PyDev to work with Python and have written a few simple example projects. Now I am trying to incorporate numpy and matplotlib. I have gotten numpy installed and within PyDev I did not need to alter any paths, etc., and after the installation of numpy I was automa...
0
1
3,642
0
4,999,217
0
0
0
0
3
true
0
2011-01-25T00:22:00.000
2
3
0
Unable to import matplotlib in PyDev
4,788,748
1.2
python,module,import,matplotlib,pydev
Sounds like the interpreter you setup for Pydev is not pointing to the appropriate version of python (that you've install mpl and np). In the terminal, it's likely the effect of typing python is tantamount to env python; pydev might not be using this interpreter. But, if the pydev interpreter is pointed to the right...
I am using Ubuntu 10.04 and have successfully configured PyDev to work with Python and have written a few simple example projects. Now I am trying to incorporate numpy and matplotlib. I have gotten numpy installed and within PyDev I did not need to alter any paths, etc., and after the installation of numpy I was automa...
0
1
3,642
0
10,869,425
0
0
0
0
2
false
11
2011-01-25T02:07:00.000
1
3
0
Orange vs NLTK for Content Classification in Python
4,789,318
0.066568
python,machine-learning,nltk,naivebayes,orange
NLTK is a toolkit that supports a four state model of natural language processing: Tokenizing: grouping characters as words. This ranges from trivial regex stuff to dealing with contractions like "can't" Tagging. This is applying part-of-speech tags to the tokens (eg "NN" for noun, "VBG" for verb gerund). This is typi...
We need a content classification module. Bayesian classifier seems to be what I am looking for. Should we go for Orange or NLTK ?
0
1
3,710
0
4,789,820
0
0
0
0
2
false
11
2011-01-25T02:07:00.000
3
3
0
Orange vs NLTK for Content Classification in Python
4,789,318
0.197375
python,machine-learning,nltk,naivebayes,orange
I don't know Orange, but +1 for NLTK: I've successively used the classification tools in NLTK to classify text and related meta data. Bayesian is the default but there are other alternatives such as Maximum Entropy. Also being a toolkit, you can customize as you see fit - eg. creating your own features (which is what I...
We need a content classification module. Bayesian classifier seems to be what I am looking for. Should we go for Orange or NLTK ?
0
1
3,710
0
4,855,557
0
1
0
0
1
false
7
2011-01-31T20:07:00.000
1
4
0
Parsing CSV data from memory in Python
4,855,523
0.049958
python,csv
Use the stringio module, which allows you to dress strings as file-like objects. That way you can pass a stringio "file" to the CSV module for parsing (or any other parser you may be using).
Is there a way to parse CSV data in Python when the data is not in a file? I'm storing CSV data in my database and I'd like to parse it. I'm looking for something analogous to Ruby's CSV.parse. I know Python has a CSV class but everything I've seen in the docs seems to deal with files as opposed to in-memory CSV data. ...
0
1
6,225
0
4,895,933
0
1
0
0
1
false
2
2011-02-04T07:45:00.000
0
2
0
How would I go about categorizing sentences according to tense (present, past, future, etc.)?
4,895,661
0
python,nlp,grammar,nltk
May be you need simply define patterns like "noun verb noun" etc for each type of grammatical structure and search matches in part-of-speach tagger output sequence.
I want to parse a text and categorize the sentences according to their grammatical structure, but I have a very small understanding of NLP so I don't even know where to start. As far as I have read, I need to parse the text and find out (or tag?) the part-of-speech of every word. Then I search for the verb clause or wh...
0
1
1,212
0
4,908,925
0
0
0
0
1
false
17
2011-02-05T05:50:00.000
8
3
0
How to incrementally train an nltk classifier
4,905,368
1
python,nltk
There's 2 options that I know of: 1) Periodically retrain the classifier on the new data. You'd accumulate new training data in a corpus (that already contains the original training data), then every few hours, retrain & reload the classifier. This is probably the simplest solution. 2) Externalize the internal model, t...
I am working on a project to classify snippets of text using the python nltk module and the naivebayes classifier. I am able to train on corpus data and classify another set of data but would like to feed additional training information into the classifier after initial training. If I'm not mistaken, there doesn't app...
0
1
3,608
0
4,909,786
0
1
0
0
1
false
5
2011-02-05T21:23:00.000
2
2
0
Python: Multi-dimensional array of different types
4,909,748
0.197375
python,arrays
In many cases such arrays are not required as there are more elegant solutions to these problems. Explain what you want to do so someone can give some hints. Anyway, if you really, really need such data structure, use array.array.
Is it possible to create a multi-dimensional array of different types in Python? The way I usually solve it is [([None] * n) for i in xrange(m)], but I don't want to use list. I want something which is really a continuous array of pointers in memory, not a list. (Each list itself is continuous, but when you make a list...
0
1
5,249
0
4,919,289
0
0
0
0
1
false
10
2011-02-05T23:48:00.000
1
2
0
Comparing/Clustering Trajectories (GPS data of (x,y) points) and Mining the data
4,910,510
0.099668
python,algorithm,gps,gis,data-mining
1) Extracting trajectories I think you are in right direction. There are probably will be some noise in gps data, and random walking, you should do some smooth like splines to overcome it. 2) Mining the trajectories Is there are any business sense in similar trajectories? (This will help build distance metric and th...
I've got 2 questions on analyzing a GPS dataset. 1) Extracting trajectories I have a huge database of recorded GPS coordinates of the form (latitude, longitude, date-time). According to date-time values of consecutive records, I'm trying to extract all trajectories/paths followed by the person. For instance; say from t...
0
1
6,451
0
4,934,824
0
0
0
0
1
true
3
2011-02-08T15:03:00.000
6
1
0
Is there a way to extract text information from a postscript file? (.ps .eps)
4,934,669
1.2
python,image,text,postscript
It's likely that pgplot drew the fonts in the text directly with lines rather than using text. Especially since pgplot is designed to output to a huge range of devices including plotters where you would have to do this. Edit: If you have enough plots to be worth the effort than it's a very simple image process...
I want to extract the text information contained in a postscript image file (the captions to my axis labels). These images were generated with pgplot. I have tried ps2ascii and ps2txt on Ubuntu but they didn't produce any useful results. Does anyone know of another method? Thanks
0
1
1,410
1
4,938,599
0
0
0
0
1
true
3
2011-02-08T21:17:00.000
5
2
0
How do I control where an R plot is displayed, using python and rpy2?
4,938,556
1.2
python,r,plot,rpy2
Plot to a graphics file using jpeg(), png() or another device, then display that file on your wxWidget.
I'm writing a program in Python. The first thing that happens is a window is displayed (I'm using wxPython) that has some buttons and text. When the user performs some actions, a plot is displayed in its own window. This plot is made with R, using rpy2. The problem is that the plot usually pops up on top of the mai...
0
1
757
0
5,640,511
0
0
0
0
1
true
1
2011-02-09T03:56:00.000
1
1
0
How to draw matplotlib graph in eclipse?
4,941,162
1.2
python,eclipse,matplotlib
import matplotlib.pyplot as mp mp.ion() mp.plot(x,y) mp.show()
I can draw matplotlib graph in command line(shell) environment, but I find that I could not draw the same graph inside the eclipse IDE. such as plot([1,2,3]) not show in eclipse, I writed show() in the end but still not show anything my matplotlib use GTKAgg as backend, I use Pydev as plugin of eclipse to develop pyth...
0
1
3,911
0
4,962,223
0
1
0
0
2
false
0
2011-02-10T20:21:00.000
1
5
0
Python - Dijkstra's Algorithm
4,962,202
0.039979
python,dijkstra
Encapsulate that information in a Python object and you should be fine.
I need to implement Dijkstra's Algorithm in Python. However, I have to use a 2D array to hold three pieces of information - predecessor, length and unvisited/visited. I know in C a Struct can be used, though I am stuck on how I can do a similar thing in Python, I am told it's possible but I have no idea to be honest
0
1
5,571
0
4,962,291
0
1
0
0
2
false
0
2011-02-10T20:21:00.000
0
5
0
Python - Dijkstra's Algorithm
4,962,202
0
python,dijkstra
Python is object oriented language. So think of it like moving from Structs in C to Classes of C++. You can use the same class structure in Python as well.
I need to implement Dijkstra's Algorithm in Python. However, I have to use a 2D array to hold three pieces of information - predecessor, length and unvisited/visited. I know in C a Struct can be used, though I am stuck on how I can do a similar thing in Python, I am told it's possible but I have no idea to be honest
0
1
5,571
0
38,577,661
0
1
0
0
4
false
7
2011-02-11T17:23:00.000
2
5
0
Unable to reinstall PyTables for Python 2.7
4,972,079
0.07983
python,hdf5,pytables
Do the following steps: brew tap homebrew/science brew install hdf5 see where hdf5 is installed, it shows at the end of second step export HDF5_DIR=/usr/local/Cellar/hdf5/1.8.16_1/ (Depending on the location that is installed on your computer) This one worked for me on MAC :-)
I am installing Python 2.7 in addition to 2.7. When installing PyTables again for 2.7, I get this error - Found numpy 1.5.1 package installed. .. ERROR:: Could not find a local HDF5 installation. You may need to explicitly state where your local HDF5 headers and library can be found by setting the HDF5_DIR environment...
0
1
6,903
0
29,871,380
0
1
0
0
4
false
7
2011-02-11T17:23:00.000
2
5
0
Unable to reinstall PyTables for Python 2.7
4,972,079
0.07983
python,hdf5,pytables
I had to install libhdf5-8 and libhdf5-serial-dev first. Then, for me, the command on Ubuntu was: export HDF5_DIR=/usr/lib/x86_64-linux-gnu/hdf5/serial/
I am installing Python 2.7 in addition to 2.7. When installing PyTables again for 2.7, I get this error - Found numpy 1.5.1 package installed. .. ERROR:: Could not find a local HDF5 installation. You may need to explicitly state where your local HDF5 headers and library can be found by setting the HDF5_DIR environment...
0
1
6,903
0
13,868,984
0
1
0
0
4
false
7
2011-02-11T17:23:00.000
4
5
0
Unable to reinstall PyTables for Python 2.7
4,972,079
0.158649
python,hdf5,pytables
My HDF5 was installed with homebrew, so setting the environment variable as follows worked for me: HDF5_DIR=/usr/local/Cellar/hdf5/1.8.9
I am installing Python 2.7 in addition to 2.7. When installing PyTables again for 2.7, I get this error - Found numpy 1.5.1 package installed. .. ERROR:: Could not find a local HDF5 installation. You may need to explicitly state where your local HDF5 headers and library can be found by setting the HDF5_DIR environment...
0
1
6,903
0
4,992,253
0
1
0
0
4
true
7
2011-02-11T17:23:00.000
4
5
0
Unable to reinstall PyTables for Python 2.7
4,972,079
1.2
python,hdf5,pytables
The hdf5 command line option was not stated correctly ( --hdf5='/usr/local/hdf5' ). Sprinkling print statements in the setup.py made it easier to pin down the problem.
I am installing Python 2.7 in addition to 2.7. When installing PyTables again for 2.7, I get this error - Found numpy 1.5.1 package installed. .. ERROR:: Could not find a local HDF5 installation. You may need to explicitly state where your local HDF5 headers and library can be found by setting the HDF5_DIR environment...
0
1
6,903
0
4,989,194
0
0
1
0
1
true
0
2011-02-14T04:31:00.000
1
1
0
Lattice Multiplication with threads, is it more efficient?
4,988,830
1.2
java,python,c,multiplication
If I understand you correctly, "lattice multiplication" is different way of doing base-10 multiplication by hand that is supposed to be easier for kids to understand than the classic way. I assume "common multiplication" is the classic way. So really, I think that the best answer is: Neither "lattice multiplication" ...
which one is faster: Using Lattice Multiplication with threads(big numbers) OR Using common Multiplication with threads(big numbers) Do you know any source code, to test them? -----------------EDIT------------------ The theads should be implemented in C, or Java for testing
0
1
519
0
5,022,089
0
0
0
0
2
false
1
2011-02-16T20:48:00.000
3
4
0
large set of data, interpolation
5,021,921
0.148885
python,numpy,scipy,data-fitting
Except, a spline does not give you a "formula", at least not unless you have the wherewithal to deal with all of the piecewise segments. Even then, it will not be easily written down, or give you anything that is at all pretty to look at. A simple spline gives you an interpolant. Worse, for 3000 points, an interpolatin...
I am looking for a "method" to get a formula, formula which comes from fitting a set of data (3000 point). I was using Legendre polynomial, but for > 20 points it gives not exact values. I can write chi2 test, but algorithm needs a loot of time to calculate N parameters, and at the beginning I don't know how the functi...
0
1
2,988
0
5,022,008
0
0
0
0
2
false
1
2011-02-16T20:48:00.000
0
4
0
large set of data, interpolation
5,021,921
0
python,numpy,scipy,data-fitting
The only formula would be a polynomial of order 3000. How good does the fit need to be? What type of formula do you expect?
I am looking for a "method" to get a formula, formula which comes from fitting a set of data (3000 point). I was using Legendre polynomial, but for > 20 points it gives not exact values. I can write chi2 test, but algorithm needs a loot of time to calculate N parameters, and at the beginning I don't know how the functi...
0
1
2,988
0
34,021,509
0
0
0
0
3
false
5
2011-02-17T00:27:00.000
1
3
0
Problem with scipy.optimize.fmin_slsqp when using very large or very small numbers
5,023,846
0.066568
python,scipy,histogram,gaussian,least-squares
I got in trouble with this issue too, but I solved it in my project. I'm not sure if this is a general solution. The reason was that the scipy.optimize.fmin_slsqp calculated the gradient by an approximate approach when the argument jac is set by False or default. The gradient produced from the approximate approach was ...
Has anybody ever encountered problems with fmin_slsqp (or anything else in scipy.optimize) only when using very large or very small numbers? I am working on some python code to take a grayscale image and a mask, generate a histogram, then fit multiple gaussians to the histogram. To develop the code I used a small samp...
0
1
5,001
0
5,690,969
0
0
0
0
3
false
5
2011-02-17T00:27:00.000
4
3
0
Problem with scipy.optimize.fmin_slsqp when using very large or very small numbers
5,023,846
0.26052
python,scipy,histogram,gaussian,least-squares
Are you updating your initial guess ("x0") when your underlying data changes scale dramatically? for any iterative linear optimization problem, these problems will occur if your initial guess is far from the data you're trying to fit. It's more of a optimization problem than a scipy problem.
Has anybody ever encountered problems with fmin_slsqp (or anything else in scipy.optimize) only when using very large or very small numbers? I am working on some python code to take a grayscale image and a mask, generate a histogram, then fit multiple gaussians to the histogram. To develop the code I used a small samp...
0
1
5,001
0
8,394,696
0
0
0
0
3
false
5
2011-02-17T00:27:00.000
5
3
0
Problem with scipy.optimize.fmin_slsqp when using very large or very small numbers
5,023,846
0.321513
python,scipy,histogram,gaussian,least-squares
I've had similar problems optimize.leastsq. The data I need to deal with often are very small, like 1e-18 and such, and I noticed that leastsq doesn't converge to best fit parameters in those cases. Only when I scale the data to something more common (like in hundreds, thousands, etc., something you can maintain reso...
Has anybody ever encountered problems with fmin_slsqp (or anything else in scipy.optimize) only when using very large or very small numbers? I am working on some python code to take a grayscale image and a mask, generate a histogram, then fit multiple gaussians to the histogram. To develop the code I used a small samp...
0
1
5,001
0
5,040,977
0
0
0
0
1
false
9
2011-02-18T10:54:00.000
2
8
0
How to draw the largest polygon from a set of points
5,040,412
0.049958
python,matplotlib
From your comments to other answers, you seem to already get the set of points defining the convex hull, but they're not ordered. The easiest way to order them would be to take a point inside the convex hull as the origin of a new coordinate frame. You then transform the (most probably) Cartesian coordinates of your po...
So, i have a set of points (x,y), and i want to be able to draw the largest polygon with these points as vertices. I can use patches.Polygon() in matplotlib, but this simply draws lines between the points in the order i give them. This doesn't automatically do what i want. As an example, if a want to draw a square, and...
0
1
5,735
0
5,085,486
0
0
0
0
1
false
0
2011-02-18T17:15:00.000
1
1
0
nltk.cluster using a sparse representation
5,044,359
0.197375
python,nltk
It means that when you pass in the input vector, you can either pass in a numpy.array() or a nltk_contrib.unimelb.tacohn.SparseArrays. I suggest you look at the package nltk_contrib.unimelb.tacohn to find the SparseArrays class. Then try to create your data with this class before passing it into nltk.cluster
I am quite new in Python. I am trying to use the nltk.cluster package to apply a simple kMeans to a word-document matrix. While it works when the matrix is a list of numpy array-like objects, I wasn't able to make it work for a sparse matrix representation (such as csc_matrix, csr_matrix or lil_matrix). All the inform...
0
1
824
0
6,637,984
0
0
0
0
1
false
4
2011-02-22T22:07:00.000
1
2
0
Named Entity Recognition from personal Gazetter using Python
5,084,578
0.099668
python,nlp,nltk,named-entity-recognition
I haven't used NLTK enough recently, but if you have words that you know are skills, you don't need to do NER- just a text search. Maybe use Lucene or some other search library to find the text, and then annotate it? That's a lot of work but if you are working with a lot of data that might be ok. Alternatively, you cou...
I try to do named entity recognition in python using NLTK. I want to extract personal list of skills. I have the list of skills and would like to search them in requisition and tag the skills. I noticed that NLTK has NER tag for predefine tags like Person, Location etc. Is there a external gazetter tagger in Python I c...
0
1
2,226
0
5,112,349
0
0
0
0
1
false
3
2011-02-25T00:26:00.000
1
3
0
Python RGB array to HSL and back
5,112,248
0.066568
python,c,rgb
One option is to use OpenCV. Their Python bindings are pretty good (although not amazing). The upside is that it is a very powerful library, so this would just be the tip of the iceberg. You could probably also do this very efficiently using numpy.
well i've seen some code to convert RGB to HSL; but how to do it fast in python. Its strange to me, that for example photoshop does this within a second on a image, while in python this often takes forever. Well at least the code i use; so think i'm using wrong code to do it In my case my image is a simple but big raw ...
0
1
6,609
0
21,030,654
0
0
0
0
1
false
19
2011-02-26T16:05:00.000
0
4
0
Can I get a view of a numpy array at specified indexes? (a view from "fancy indexing")
5,127,991
0
python,numpy
You could theoretically create an object that performs the role of a 'fancy view' into another array, and I can think of plenty of use cases for it. The problem is, that such an object would not be compatible with the standard numpy machinery. All compiled numpy C code relies on data being accessible as an inner produc...
What i need is a way to get "fancy indexing" (y = x[[0, 5, 21]]) to return a view instead of a copy. I have an array, but i want to be able to work with a subset of this array (specified by a list of indices) in such a way that the changes in this subset is also put into the right places in the large array. If i just ...
0
1
3,684
0
5,136,547
0
1
0
0
2
false
1
2011-02-27T22:35:00.000
3
5
0
python random number
5,136,533
0.119427
python
Since a dice has 6 possible outcomes, if you get a 2 three times, this would be : 0 3 0 0 0 0
I was wondering if someone can clarify this line for me. Create a function die(x) which rolls a die x times keeping track of how many times each face comes up and returns a 1X6 array containing these numbers. I am not sure what this means when it says 1X6 array ? I am using the randint function from numpy so th...
0
1
688
0
5,136,717
0
1
0
0
2
false
1
2011-02-27T22:35:00.000
1
5
0
python random number
5,136,533
0.039979
python
if you have the results of the die rolls in a list lst, you can determine the number of times a 4 appeared by doing len([_ for _ in lst if _ == 4]). you should be able to figure the rest out from there.
I was wondering if someone can clarify this line for me. Create a function die(x) which rolls a die x times keeping track of how many times each face comes up and returns a 1X6 array containing these numbers. I am not sure what this means when it says 1X6 array ? I am using the randint function from numpy so th...
0
1
688
0
5,150,092
0
0
0
0
1
true
0
2011-03-01T03:03:00.000
2
1
0
Best text miner to use with python
5,150,053
1.2
python
I would go with NLTK since it's written in Python
I want to use a easy-to-use text miner with my python code. I will be mainly using the classification algorithms - Naive Bayes, KNN and such. Please let me know what's the best option here - Weka? NLTK? SVM? or something else? Thanks!
0
1
142
0
5,159,762
0
0
0
0
1
false
2
2011-03-01T14:09:00.000
1
2
0
creating a 3d numpy array from a non-contigous set of contigous 2d slices
5,155,597
0.099668
c++,python,numpy,python-c-api
Short answer, no. Numpy expects all the data to be laid it in a simple, strided pattern. When iterating over the array, to advance in a dimension, it adds a constant, the stride size for that dimension, to the position in memory. So unless your 2-d slices are laid out regularly (e.g. every other row of a larger 3-d a...
Is it possible to use PyArray_NewFromDescr to create numpy array object from a set of contiguous 2d arrays, without copying the data?
0
1
444
0
6,088,759
0
1
0
0
5
false
26
2011-03-06T23:52:00.000
12
11
0
Python vs Matlab
5,214,369
1
python,matlab,ide
I've been getting on very well with the Spyder IDE in the Python(x,y) distribution. I'm a long term user of Matlab and have known of the existence of Python for 10 years or so but it's only since I installed Python(x,y) that I've started using Python regularly.
I'm considering making the switch from MATLAB to Python. The application is quantitative trading and cost is not really an issue. There are a few things I love about MATLAB and am wondering how Python stacks up (could not find any answers in the reviews I've read). Is there an IDE for Python that is as good as MATLAB'...
0
1
47,020
0
10,388,279
0
1
0
0
5
false
26
2011-03-06T23:52:00.000
2
11
0
Python vs Matlab
5,214,369
0.036348
python,matlab,ide
after long long tryouts with many editors, i have settled for aptana ide + ipython (including notebook in internet browser) great for editing, getting help easy, try fast new things aptana is the same as eclipse (because of pydev) but aptana has themes and different little things eclipse lacks about python a little, do...
I'm considering making the switch from MATLAB to Python. The application is quantitative trading and cost is not really an issue. There are a few things I love about MATLAB and am wondering how Python stacks up (could not find any answers in the reviews I've read). Is there an IDE for Python that is as good as MATLAB'...
0
1
47,020
0
41,910,220
0
1
0
0
5
false
26
2011-03-06T23:52:00.000
6
11
0
Python vs Matlab
5,214,369
1
python,matlab,ide
I've been in the engineering field for a while now and I've always used MATLAB for high-complexity math calculations. I never really had an major problems with it, but I wasn't super enthusiastic about it either. A few months ago I found out I was going to be a TA for a numerical methods class and that it would be taug...
I'm considering making the switch from MATLAB to Python. The application is quantitative trading and cost is not really an issue. There are a few things I love about MATLAB and am wondering how Python stacks up (could not find any answers in the reviews I've read). Is there an IDE for Python that is as good as MATLAB'...
0
1
47,020
0
5,214,892
0
1
0
0
5
false
26
2011-03-06T23:52:00.000
2
11
0
Python vs Matlab
5,214,369
0.036348
python,matlab,ide
almost everything is covered by others .. i hope you don't need any toolboxes like optimizarion toolbox , neural network etc.. [ I didn't find these for python may be there are some .. i seriously doubt they might be better than Matlab ones..] if u don't need symbolic manipulation capability and are using windows pyth...
I'm considering making the switch from MATLAB to Python. The application is quantitative trading and cost is not really an issue. There are a few things I love about MATLAB and am wondering how Python stacks up (could not find any answers in the reviews I've read). Is there an IDE for Python that is as good as MATLAB'...
0
1
47,020
0
9,317,942
0
1
0
0
5
false
26
2011-03-06T23:52:00.000
1
11
0
Python vs Matlab
5,214,369
0.01818
python,matlab,ide
I have recently switched from MATLAB to Python (I am about 2 months into the transition), and am getting on fairly well using Sublime Text 2, using the SublimeRope and SublimeLinter plugins to provide some IDE-like capabilities, as well as pudb to provide some graphical interactive debugging capabilities. I have not ye...
I'm considering making the switch from MATLAB to Python. The application is quantitative trading and cost is not really an issue. There are a few things I love about MATLAB and am wondering how Python stacks up (could not find any answers in the reviews I've read). Is there an IDE for Python that is as good as MATLAB'...
0
1
47,020
0
7,501,276
0
1
0
0
1
false
4
2011-03-07T19:42:00.000
6
2
0
Differences between python's numpy.ndarray and list datatypes
5,224,420
1
python,arrays,list,performance,numpy
There are several differences: You can append elements to a list, but you can't change the size of a ´numpy.ndarray´ without making a full copy. Lists can containt about everything, in numpy arrays all the elements must have the same type. In practice, numpy arrays are faster for vectorial functions than mapping funct...
What are the differences between python's numpy.ndarray and list datatypes? I have vague ideas, but would like to get a definitive answer about: Size in memory Speed / order of access Speed / order of modification in place but preserving length Effects of changing length Thanks!
0
1
5,003
0
5,231,844
0
0
0
0
1
true
4
2011-03-08T11:09:00.000
5
1
0
Calculating point-wise mutual information (PMI) score for n-grams in Python
5,231,627
1.2
python,n-gram
If I'm understanding your problem correctly, you want to compute things like log { P("x1 x2 x3 x4 x5") / P("x1") P("x2") ... P("x5") } where P measures the probability that any given 5-gram or 1-gram is a given thing (and is basically a ratio of counts, perhaps with Laplace-style offsets). So, make a single pass throug...
I have a large corpus of n-grams and several external n-grams. I want to calculate the PMI score of each external n-gram based on this corpus (the counts). Are there any tools to do this or can someone provide me with a piece of code in Python that can do this? The problem is that my n-grams are 2-grams, 3-grams, 4-gr...
0
1
4,572
0
5,268,722
0
0
0
0
2
false
1
2011-03-11T02:39:00.000
3
3
0
Pipe numpy data in Linux?
5,268,391
0.197375
python,linux,ubuntu,numpy,pipe
Check out the save and load functions. I don't think they would object to being passed a pipe instead of a file.
Is it possible to pipe numpy data (from one python script ) into the other? suppose that script1.py looks like this: x = np.zeros(3, dtype={'names':['col1', 'col2'], 'formats':['i4','f4']}) print x Suppose that from the linux command, I run the following: python script1.py | script2.py Will script2.py get the piped num...
0
1
751
0
5,268,401
0
0
0
0
2
true
1
2011-03-11T02:39:00.000
2
3
0
Pipe numpy data in Linux?
5,268,391
1.2
python,linux,ubuntu,numpy,pipe
No, data is passed through a pipe as text. You'll need to serialize the data in script1.py before writing, and deserialize it in script2.py after reading.
Is it possible to pipe numpy data (from one python script ) into the other? suppose that script1.py looks like this: x = np.zeros(3, dtype={'names':['col1', 'col2'], 'formats':['i4','f4']}) print x Suppose that from the linux command, I run the following: python script1.py | script2.py Will script2.py get the piped num...
0
1
751
0
5,299,434
0
0
0
0
1
false
2
2011-03-14T13:35:00.000
1
3
0
Program, that chooses the best out of 10
5,299,280
0.066568
python,algorithm,variations
I'd solve this exercise with dynamic programming. You should be able to get the optimal solution in O(m*n) operations (n beeing the number of cars, m beeing the total mass). That will only work however if the masses are all integers. In general you have a binary linear programming problem. Those are very hard in genera...
I need to make a program in python that chooses cars from an array, that is filled with the mass of 10 cars. The idea is that it fills a barge, that can hold ~8 tonnes most effectively and minimum space is left unfilled. My idea is, that it makes variations of the masses and chooses one, that is closest to the max weig...
0
1
230
0
5,330,143
0
0
0
0
1
false
7
2011-03-16T18:30:00.000
2
4
0
Dictionary-like efficient storing of scipy/numpy arrays
5,330,010
0.099668
python,serialization,numpy,scipy
I would suggest to use scipy.save and have an dictionnary between the word and the name of the files.
BACKGROUND The issue I'm working with is as follows: Within the context of an experiment I am designing for my research, I produce a large number of large (length 4M) arrays which are somewhat sparse, and thereby could be stored as scipy.sparse.lil_matrix instances, or simply as scipy.array instances (the space gain/l...
0
1
3,381
0
5,357,196
0
0
0
0
3
false
1
2011-03-18T19:55:00.000
6
11
0
how to generate all possible combinations of a 14x10 matrix containing only 1's and 0's
5,357,171
1
python,arrays,matlab,matrix
Generating Every possible matrix of 1's and 0's for 14*10 would generate 2**140 matrixes. I don't believe you would have enough lifetime for this. I don't know, if the sun would still shine before you finish that. This is why it is impossible to generate all those matrices. You must look for some other solution, this l...
I'm working on a problem and one solution would require an input of every 14x10 matrix that is possible to be made up of 1's and 0's... how can I generate these so that I can input every possible 14x10 matrix into another function? Thank you! Added March 21: It looks like I didn't word my post appropriately. Sorry. Wh...
0
1
3,156
0
5,357,340
0
0
0
0
3
false
1
2011-03-18T19:55:00.000
0
11
0
how to generate all possible combinations of a 14x10 matrix containing only 1's and 0's
5,357,171
0
python,arrays,matlab,matrix
Instead of just suggesting the this is unfeasible, I would suggest considering a scheme that samples the important subset of all possible combinations instead of applying a brute force approach. As one of your replies suggested, you are doing minimization. There are numerical techniques to do this such as simulated ann...
I'm working on a problem and one solution would require an input of every 14x10 matrix that is possible to be made up of 1's and 0's... how can I generate these so that I can input every possible 14x10 matrix into another function? Thank you! Added March 21: It looks like I didn't word my post appropriately. Sorry. Wh...
0
1
3,156
0
5,357,209
0
0
0
0
3
false
1
2011-03-18T19:55:00.000
0
11
0
how to generate all possible combinations of a 14x10 matrix containing only 1's and 0's
5,357,171
0
python,arrays,matlab,matrix
Are you saying that you have a table with 140 cells and each value can be 1 or 0 and you'd like to generate every possible output? If so, you would have 2^140 possible combinations...which is quite a large number.
I'm working on a problem and one solution would require an input of every 14x10 matrix that is possible to be made up of 1's and 0's... how can I generate these so that I can input every possible 14x10 matrix into another function? Thank you! Added March 21: It looks like I didn't word my post appropriately. Sorry. Wh...
0
1
3,156
0
58,834,043
0
1
0
0
2
false
475
2011-03-19T18:39:00.000
1
14
0
Reloading submodules in IPython
5,364,050
0.014285
python,ipython
Note that the above mentioned autoreload only works in IntelliJ if you manually save the changed file (e.g. using ctrl+s or cmd+s). It doesn't seem to work with auto-saving.
Currently I am working on a python project that contains sub modules and uses numpy/scipy. Ipython is used as interactive console. Unfortunately I am not very happy with workflow that I am using right now, I would appreciate some advice. In IPython, the framework is loaded by a simple import command. However, it is oft...
0
1
217,455
0
57,911,718
0
1
0
0
2
false
475
2011-03-19T18:39:00.000
0
14
0
Reloading submodules in IPython
5,364,050
0
python,ipython
Any subobjects will not be reloaded by this, I believe you have to use IPython's deepreload for that.
Currently I am working on a python project that contains sub modules and uses numpy/scipy. Ipython is used as interactive console. Unfortunately I am not very happy with workflow that I am using right now, I would appreciate some advice. In IPython, the framework is loaded by a simple import command. However, it is oft...
0
1
217,455
0
5,377,789
0
0
0
0
1
false
0
2011-03-21T12:07:00.000
0
2
0
how to calculate trendline for stock charts
5,377,347
0
python,stocks
You could think about using a method that calculates the concave hull of your data. There are probably existing python implementations you could find. This will give you the boundary that encloses your timeseries. If there are outliers in your dataset that you wish to exclude, you could apply some sort of filter or smo...
I have read the topic: How do I calculate a trendline for a graph? What I am looking for though is how to find the line that touches the outer extreme points of a graph. The intended use is calculation of support, resistance lines for stock charts. So it is not a merely simple regression but it should also limit the n...
0
1
2,927
0
5,392,702
0
1
0
0
1
false
5
2011-03-22T14:08:00.000
-2
4
0
access numpy array from a functional language
5,392,551
-0.099668
python,haskell,functional-programming,numpy,scipy
I can't imagine trying to use numpy through haskell or scheme will be easier than just writing functional python. Try using itertools and functools if you want a more functional flavored python.
My primary language is Python. Often when I need to do some cpu heavy task on a numpy array I use scipy.weave.inline to hook up c++ with great results. I suspect many of the algorithms (machine learning stuff) can however be written simpler in a functional language (scheme, haskell...). I was thinking. Is it possible t...
0
1
887
0
5,397,912
0
1
0
0
1
false
3
2011-03-22T21:04:00.000
1
3
0
Python - Best data structure for incredibly large matrix
5,397,809
0.066568
python,data-structures,vector,matrix,large-data-volumes
Use a sparse matrix assuming most entries are 0.
I need to create about 2 million vectors w/ 1000 slots in each (each slot merely contains an integer). What would be the best data structure for working with this amount of data? It could be that I'm over-estimating the amount of processing/memory involved. I need to iterate over a collection of files (about 34.5GB in ...
0
1
1,730
0
5,627,073
0
0
0
0
1
true
2
2011-03-28T19:19:00.000
0
1
0
transforming coordinates in matplotlib
5,463,924
1.2
python,numpy,matplotlib,scipy
If you simply use matplotlib's plot function, the plot will fit into one online window, so you don't really need to 'rescale' explicitly. Linearly rescaling is pretty easy, if you include some code sample to show your formatting of the data, somebody can help you in translating the origin and scaling the coordinates.
I'm trying to plot a series of rectangles and lines based on a tab delimited text file in matplotlib. The coordinates are quite large in the data and shown be drawn to scale -- except scaled down by some factor X -- in matplotlib. What's the easiest way to do this in matplotlib? I know that there are transformations,...
0
1
1,909
0
5,466,008
0
0
0
0
1
false
2
2011-03-28T22:54:00.000
2
2
0
Run Fortran command line program within Python
5,465,982
0.197375
python,numpy,scipy,fortran77
Can't you just dump the data generated by the Fortran program to a file and then read it from python ? Numpy can read a binary file and treat it as a array. Going from here to matplotlib then should be a breeeze.
So I am in a bit of a pickle. I am trying to write plotting and fitting extensions to a Fortran77 (why this program was rewritten in F77 is a mystery too me, btw) code that requires command line input, i.e. it prompts the user for input. Currently the program uses GNUplot to plot, but the GNUplot fitting routine is les...
0
1
3,047
0
5,469,268
0
0
0
0
1
false
5
2011-03-29T06:53:00.000
1
2
0
Reading and graphing data read from huge files
5,468,921
0.099668
python,r,numpy,large-files,graphing
I think python+Numpy would be the most efficient way, regarding speed and ease of implementation. Numpy is highly optimized so the performance is decent, and python would ease up the algorithm implementation part. This combo should work well for your case, providing you optimize the loading of the file on memory, try t...
We have pretty large files, the order of 1-1.5 GB combined (mostly log files) with raw data that is easily parseable to a csv, which is subsequently supposed to be graphed to generate a set of graph images. Currently, we are using bash scripts to turn the raw data into a csv file, with just the numbers that need to be ...
0
1
2,960
0
5,494,360
0
0
0
0
1
false
7
2011-03-30T23:10:00.000
0
2
0
Wordnet selectional restrictions in NLTK
5,493,565
0
python,nlp,nltk,wordnet
You could try using some of the similarity functions with handpicked synsets, and use that to filter. But it's essentially the same as following the hypernym tree - afaik all the wordnet similarity functions use hypernym distance in their calculations. Also, there's a lot of optional attributes of a synset that might b...
Is there a way to capture WordNet selectional restrictions (such as +animate, +human, etc.) from synsets through NLTK? Or is there any other way of providing semantic information about synset? The closest I could get to it were hypernym relations.
0
1
820
0
5,527,011
0
1
0
0
2
true
1
2011-04-03T01:29:00.000
2
2
0
Can you pickle methods python method objects using any pickle module?
5,526,981
1.2
python,pickle
You can pickle plain functions. Python stores the name and module and uses that to reload it. If you want to do the same with methods and such that's a little bit trickier. It can be done by breaking such objects down into component parts and pickling those.
I've got a long-running script, and the operations that it performs can be broken down into independent, but order-sensitive function calls. In addition, the pattern here is a bread-first walk over a graph, and restarting a depth after a crash is not a happy option. So then, my idea is as follows: as the script runs, ...
0
1
852
0
5,526,985
0
1
0
0
2
false
1
2011-04-03T01:29:00.000
0
2
0
Can you pickle methods python method objects using any pickle module?
5,526,981
0
python,pickle
If the arguments are all that matters, why not store the arguments? Just store it as a straight tuple.
I've got a long-running script, and the operations that it performs can be broken down into independent, but order-sensitive function calls. In addition, the pattern here is a bread-first walk over a graph, and restarting a depth after a crash is not a happy option. So then, my idea is as follows: as the script runs, ...
0
1
852
0
9,875,395
0
0
0
0
3
false
213
2011-04-03T12:39:00.000
17
8
0
Is it possible to specify your own distance function using scikit-learn K-Means Clustering?
5,529,625
1
python,machine-learning,cluster-analysis,k-means,scikit-learn
Yes you can use a difference metric function; however, by definition, the k-means clustering algorithm relies on the eucldiean distance from the mean of each cluster. You could use a different metric, so even though you are still calculating the mean you could use something like the mahalnobis distance.
Is it possible to specify your own distance function using scikit-learn K-Means Clustering?
0
1
105,962
0
5,531,148
0
0
0
0
3
false
213
2011-04-03T12:39:00.000
57
8
0
Is it possible to specify your own distance function using scikit-learn K-Means Clustering?
5,529,625
1
python,machine-learning,cluster-analysis,k-means,scikit-learn
Unfortunately no: scikit-learn current implementation of k-means only uses Euclidean distances. It is not trivial to extend k-means to other distances and denis' answer above is not the correct way to implement k-means for other metrics.
Is it possible to specify your own distance function using scikit-learn K-Means Clustering?
0
1
105,962
0
56,324,541
0
0
0
0
3
false
213
2011-04-03T12:39:00.000
4
8
0
Is it possible to specify your own distance function using scikit-learn K-Means Clustering?
5,529,625
0.099668
python,machine-learning,cluster-analysis,k-means,scikit-learn
Sklearn Kmeans uses the Euclidean distance. It has no metric parameter. This said, if you're clustering time series, you can use the tslearn python package, when you can specify a metric (dtw, softdtw, euclidean).
Is it possible to specify your own distance function using scikit-learn K-Means Clustering?
0
1
105,962
0
5,555,313
0
0
0
0
1
false
8
2011-04-05T13:30:00.000
2
2
0
plotting a 2D matrix in python, code and most useful visualization
5,552,641
0.197375
python,numpy,matplotlib,plot,visualization
The key thing to consider is whether you have important structure along both dimensions in the matrix. If you do then it's worth trying a colored matrix plot (e.g., imshow), but if your ten topics are basically independent, you're probably better off doing ten individual line or histogram plots. Both plots have advan...
I have a very large matrix(10x55678) in "numpy" matrix format. the rows of this matrix correspond to some "topics" and the columns correspond to words(unique words from a text corpus). Each entry i,j in this matrix is a probability, meaning that word j belongs to topic i with probability x. since I am using ids rather ...
0
1
30,834
0
5,556,151
0
1
0
0
1
false
1
2011-04-05T17:31:00.000
1
2
0
Finding an object within an image containing many objects (Python)
5,555,975
0.099668
python,algorithm,image-processing
I guess the most straightforward way to achieve this is to compute the correlation map of the two images. Just convolve the two images using a scientific library such as scipy, apply a low pass filter and find the maximum value of the result. You should check out the following packages: numpy scipy matplotlib PIL if y...
I have to create a python image processing program which reads in two images, one containing a single object and the other containing several objects. However, the first images object is present in the second image but is surrounded by other objects (some similar). The images are both the same size but I am having pro...
0
1
711
0
5,715,781
0
0
0
0
3
true
13
2011-04-06T08:51:00.000
0
5
0
Check for positive definiteness or positive semidefiniteness
5,563,743
1.2
python,math,matrix,scipy,linear-algebra
One good solution is to calculate all the minors of determinants and check they are all non negatives.
I want to check if a matrix is positive definite or positive semidefinite using Python. How can I do that? Is there a dedicated function in SciPy for that or in other modules?
0
1
19,269
0
5,565,951
0
0
0
0
3
false
13
2011-04-06T08:51:00.000
0
5
0
Check for positive definiteness or positive semidefiniteness
5,563,743
0
python,math,matrix,scipy,linear-algebra
an easier method is to calculate the determinants of the minors for this matrx.
I want to check if a matrix is positive definite or positive semidefinite using Python. How can I do that? Is there a dedicated function in SciPy for that or in other modules?
0
1
19,269
0
5,563,883
0
0
0
0
3
false
13
2011-04-06T08:51:00.000
18
5
0
Check for positive definiteness or positive semidefiniteness
5,563,743
1
python,math,matrix,scipy,linear-algebra
I assume you already know your matrix is symmetric. A good test for positive definiteness (actually the standard one !) is to try to compute its Cholesky factorization. It succeeds iff your matrix is positive definite. This is the most direct way, since it needs O(n^3) operations (with a small constant), and you would...
I want to check if a matrix is positive definite or positive semidefinite using Python. How can I do that? Is there a dedicated function in SciPy for that or in other modules?
0
1
19,269
0
5,568,485
0
0
0
1
1
false
6
2011-04-06T14:47:00.000
2
5
0
use python to generate graph in excel
5,568,319
0.07983
python,excel,charts,export-to-excel
I suggest you to try gnuplot while drawing graph from data files.
I have been trying to generate data in Excel. I generated .CSV file. So up to that point it's easy. But generating graph is quite hard in Excel... I am wondering, is python able to generate data AND graph in excel? If there are examples or code snippets, feel free to post it :) Or a workaround can be use python to gene...
0
1
48,351
0
55,520,433
0
1
0
0
2
false
75
2011-04-07T03:00:00.000
15
3
0
Difference between "axes" and "axis" in matplotlib?
5,575,451
1
python,matplotlib
in the context of matplotlib, axes is not the plural form of axis, it actually denotes the plotting area, including all axis.
I'm confused about what the different between axes and axis is in matplotlib. Could someone please explain in an easy-to-understand way?
0
1
16,337
0
5,575,468
0
1
0
0
2
true
75
2011-04-07T03:00:00.000
68
3
0
Difference between "axes" and "axis" in matplotlib?
5,575,451
1.2
python,matplotlib
Axis is the axis of the plot, the thing that gets ticks and tick labels. The axes is the area your plot appears in.
I'm confused about what the different between axes and axis is in matplotlib. Could someone please explain in an easy-to-understand way?
0
1
16,337
0
5,590,275
0
0
0
0
1
true
1
2011-04-08T03:38:00.000
4
4
0
Scheme-less database solution to work on one machine only?
5,590,148
1.2
python,linux,mongodb,database,nosql
MongoDB is likely a good choice related to performance, flexibility and usability (easy approachable). However large databases require careful planning - especially when it comes to aspects of backup and high-availability. Without further insight about project requirements there is little to say if one machine is enoug...
I am looking for a scheme-less database to store roughly 10[TB] of data on disk, ideally, using a python client. The suggested solution should be free for commercial use, and have good performance for reads and writes. The main goal here is to store time-series data, including more than billion records, accessed by tim...
0
1
401
0
5,602,512
0
1
0
0
2
false
3
2011-04-09T02:22:00.000
2
6
0
Random picks from permutation generator?
5,602,488
0.066568
python,permutation,random-sample
I don't know how python implements its shuffle algorithm, but the following scales in linear time, so I don't see why a length of 10 is such a big deal (unless I misunderstand your question?): start with the list of items; go through each index in the list in turn, swapping the item at that index it for an item at a r...
How to randomly pick all the results, one by one (no repeats) from itertools.permutations(k)? Or this: how to build a generator of randomized permutations? Something like shuffle(permutations(k)). I’m using Python 2.6. Yeah, shuffle(r) could be used if r = list(permutations(k)), but such a list will take up too much t...
0
1
4,221
0
5,603,207
0
1
0
0
2
false
3
2011-04-09T02:22:00.000
2
6
0
Random picks from permutation generator?
5,602,488
0.066568
python,permutation,random-sample
There's no way of doing what you have asked for without writing your own version of permutations. Consider this: We have a generator object containing the result of permutations. We have written our own function to tell us the length of the generator. We then pick an entries at random between the beginning of the list...
How to randomly pick all the results, one by one (no repeats) from itertools.permutations(k)? Or this: how to build a generator of randomized permutations? Something like shuffle(permutations(k)). I’m using Python 2.6. Yeah, shuffle(r) could be used if r = list(permutations(k)), but such a list will take up too much t...
0
1
4,221
0
5,610,731
0
0
0
0
1
false
14
2011-04-10T05:27:00.000
3
2
0
How to save figures to pdf as raster images in matplotlib
5,609,969
0.291313
python,pdf,matplotlib,raster
Not that I know, but you can use the 'convert' program (ImageMagick') to convert a jpg to a pdf: `convert file.jpg file.pdf'.
I have some complex graphs made using matplotlib. Saving them to a pdf using the savefig command uses a vector format, and the pdf takes ages to open. Is there any way to save the figure to pdf as a raster image to get around this problem?
0
1
5,667
0
5,651,029
0
0
0
0
1
false
12
2011-04-13T11:02:00.000
2
6
0
Python tools to visualize 100k Vertices and 1M Edges?
5,648,097
0.066568
python,graph,wxpython,visualization
You should ask on the official wxPython mailing list. There are people there that can probably help you. I am surprised that matplotlib isn't able to do this though. It may just require you to restructure your code in some way. Right now, the main ways to draw in wxPython are via the various DCs, one of the FloatCanvas...
I'm looking to visualize the data, hopefully make it interactive. Right now I'm using NetworkX and Matplotlib, which maxes out my 8gb when I attempt to 'draw' the graph. I don't know what options and techniques exist for handling such a large cluster** of data. If someone could point me in the right direction, that'...
0
1
3,571
0
5,682,297
0
0
0
0
1
true
4
2011-04-15T20:43:00.000
3
2
1
Hadoop Vs. Disco Vs. Condor?
5,682,175
1.2
python,distributed-computing
I'm unfamiliar with Disco and Condor, but I can answer regarding Hadoop: Hadoop pros: Robust and proven - probably more than anything else out there. Used by many organizations (including the one I work for) to run clusters of 100s of nodes and more. Large ecosystem = support + many subprojects to make life easier (e...
I am trying to find a tool that will manage a bunch of jobs on 100 machines in a cluster (submit the jobs to the machines; make sure that jobs are run etc). Which tool would be more simple to install / manage: (1) Hadoop? (2) Disco? (3) Condor? Ideally, I am searching for a solution that would be as simple as possible,...
0
1
1,606
0
6,272,840
0
0
0
1
1
false
0
2011-04-17T11:09:00.000
1
4
0
Compoud charts with python
5,693,151
0.049958
python,charts
Pretty easy to do with pygooglechart - You can basically follow the bar chart examples that ship with the software and then use the add_data_line method to make the lines on top of the bar chart
I want to generate compound charts (e.g: Bar+line) from my database using python. How can i do this ? Thanks in Advance
0
1
277
0
5,697,057
0
0
0
0
1
true
0
2011-04-17T22:49:00.000
3
1
0
Python: How to load and use trained and pickled NLTK tagger to GAE?
5,696,995
1.2
python,google-app-engine,pickle,nltk
If your NLTK tagger code and data is of limited size, then carry it along with your GAE code. If you have to act upon it to retrain the set, then storing the content of the file as a BLOB in the datastore would be an option, so that you get, analyze, retrain and put.But that will limit size of dataitem to be less than...
I have a trained and pickled NLTK tagger (Brill's transformational rule-based tagger). I want to use it on GAE. What the best way to do it?
0
1
312
0
5,729,858
0
0
0
0
1
true
28
2011-04-19T19:49:00.000
13
3
0
Python: Making numpy default to float32
5,721,831
1.2
python,numpy,numbers
Not that I am aware of. You either need to specify the dtype explicitly when you call the constructor for any array, or cast an array to float32 (use the ndarray.astype method) before passing it to your GPU code (I take it this is what the question pertains to?). If it is the GPU case you are really worried about, I fa...
Is there any clean way of setting numpy to use float32 values instead of float64 globally?
0
1
13,987
0
5,887,256
0
0
0
0
1
false
8
2011-04-21T20:32:00.000
1
2
0
Pros and cons to using sparse matrices in python/R?
5,749,479
0.099668
python,r,sparse-matrix
There are several ways to represent sparse matrices (documentation for the R SparseM package reports 20 different ways to store sparse matrix data), so complete compatibility with all solutions is probably out of question. The number options also suggests that there is no best-in-all-situations solution. Pick either th...
I'm working with large, sparse matrices (document-feature matrices generated from text) in python. It's taking quite a bit of processing time and memory to chew through these, and I imagine that sparse matrices could offer some improvements. But I'm worried that using a sparse matrix library is going to make it harder...
0
1
872
0
5,796,773
0
0
0
0
1
true
0
2011-04-26T17:26:00.000
0
2
0
How to build numpy with conary recipe for x-86 CentOs
5,794,093
1.2
python,numpy,centos
the command $rbuild build packages numpy --no-recurse , should be executed at the level where the package is, not in Development/QA or Release Directories.
i am getting error: rbuild build packages numpy --no-recurse [Tue Apr 26 13:16:53 2011] Creating rMake build job for 1 items Added Job 902 numpy:source=rmake-repository.bericots.com@local:taf32-sandbox-1-devel/1-0.2 [13:17:23] Watching job 902 [13:17:24] [902] Loading 1 out of 1: numpy:source [13:17:26...
0
1
170
0
5,816,755
0
1
0
0
1
false
6
2011-04-27T21:50:00.000
4
3
0
confidence interval with leastsq fit in scipy python
5,811,043
0.26052
python,scipy,least-squares,confidence-interval
I am not sure what you mean by confidence interval. In general, leastsq doesn't know much about the function that you are trying to minimize, so it can't really give a confidence interval. However, it does return an estimate of the Hessian, in other word the generalization of 2nd derivatives to multidimensional problem...
How to calculate confidence interval for the least square fit (scipy.optimize.leastsq) in python?
0
1
6,800
0
5,821,933
0
0
0
0
1
false
3
2011-04-28T16:27:00.000
0
2
0
Matplotlib histogram, frequency as thousands
5,821,895
0
python,graph,matplotlib,histogram
Just convert the values yourself before they are entered. In numpy, you can do just array/1000 instead of array.
I have a histogram I'm drawing in matplotlib with some 260,000 values or so. The problem is that the frequency axis (y axis) on the histogram reaches high numbers such as 100,000... What I'd really like is to have the y labels as thousands, so instead of, for instance: 100000 75000 50000 25000 0 To have this: 100 75...
0
1
3,743
0
6,029,955
0
1
0
0
1
false
4
2011-04-29T02:27:00.000
-1
2
0
PyCUDA/CUDA: Causes of non-deterministic launch failures?
5,827,219
-0.099668
python,cuda,gpgpu,pycuda
You can use nVidia CUDA Profiler and see what gets executed before the failure.
Anyone following CUDA will probably have seen a few of my queries regarding a project I'm involved in, but for those who haven't I'll summarize. (Sorry for the long question in advance) Three Kernels, One Generates a data set based on some input variables (deals with bit-combinations so can grow exponentially), another...
0
1
913