lil-Sparse matrix row splitting [closed] - python

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have a large sparse matrix (lil) implemented in Python with scipy, which comprises of Users on one axis, and songs they played on the other. So each row is a linked list of the songs that user has played.
I need to split each row ( user's songs ) so i have training and test data, but I'm unsure of how to do this. Sorry, im new to python, any help would be greatly appreciated.

I think you need sklearn.cross_validation.train_test_split

Related

save scale data and recall data back into scale [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need to create a code that will take 24 scale values and save them in a txt. file, i then want to be able to recall these values and put them back into the 24 scales. can someone point me in the right direction.
Thanks
First read this :
http://docs.python.org/2/library/stdtypes.html#bltin-file-objects
then write some code and come back with concrete questions if necessary.

How many items are values in dictionaries, Python [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm looking to find out how to write the code to see how many values a key has in a dictionary.
For example, I'm doing a small survey on a class to see the colour of eyes, I make a dictionary and put all of their names into the dictionary as strings as values. How do i find out how many people have each colour eyes?
survey = {'blue' : ['Kyle', 'Josh', 'Michael']}
len(survey['blue'])

Python: How do I write multiple lists to one file? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Lets say I have a list of students, a list of test scores, and a list of averages. How do I write each of these lists to one file formatted so that the first student, test scores, and average will be on line one, the second student, test scores, and average will be on line two, etc.?
Try this:
with open("file.txt","w") as f:
for (student,score,avg) in zip(students,scores,avgs):
f.write("{0},{1},{2}\n".format(student,score,avg))
If you don't want to use a for loop, you could look at csv.writer, but that's hardly more "streamlined" than what I've posted here.
Without a for loop
with open("file.txt", "w") as f:
f.writelines(map("{},{},{}\n".format, students, scores, avgs))

Automatic placing of one png image into anther one [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I would like to know whether it is possible to carry out such an operation, that one picture is placed into another one at exact coordinates, automatedly.
I have a set consisting of 20 pairs of images of fixed size. I need to merge the pairs by placing first image of a pair to a fixed position on the second image.
I might need to do this mergers several times in future, so I am interested if there is a chance to write a scrypt in Python/Perl or any other simple language to handle this task. I am now using GIMP scripts, but most of the work still needs to be carried out manually...
Anyway, if this is not an option, I am asking someone to be so kind and briefly explain why is it so.
Thanks!
a lot of recepies ImageMagick v6 Examples -- Compositing Images. And you need perl-magick.

How to determine parallactic angle using pyephem [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How can I determine the parallactic angle of a target in pyEphem given a fixed object and an observer?
I am trying to use pyEphem to create an instrument simulator and I need to determine the rate at which the instrument rotator will be turning to de-rotate the field (this is an alt-az telescope), so really I'm trying to determine the rate of change of the parallactic angle.
thanks,
Josh

Categories

Resources