Advertisement
Guest User

analyze_factor

a guest
Oct 10th, 2010
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. import sys
  2. import getopt
  3. import csv
  4. import re
  5. import mdp
  6. import numpy
  7.  
  8. def read_responses():
  9.     r = csv.reader(open('test_group_responses.csv'))
  10.     return numpy.array([ line for line in r])
  11.  
  12. # Fills in respondents z-score fields for every question group in which they answered all the questions
  13. def compute_zscores(responses):
  14.    
  15.     node = mdp.nodes.FANode(output_dim=1,max_cycles=200,tol=0.00001)
  16.     zscores = node(numpy.array(responses,'float32')).transpose()[0]
  17.    
  18.     return zscores
  19.  
  20. def main():
  21.     responses = read_responses()
  22.     zscores = compute_zscores(responses)
  23.     print zscores
  24.  
  25. if __name__ == "__main__":
  26.     sys.exit(main())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement