title: Make terse Python lambda code in PySpark more understandable
body: <p>I've been able to get pyspark running a linear regression example using Anaconda on a test cluster. It's pretty cool.</p>
  
  <p>My next step is to make the code a little more templatized for our analysts. Specifically I'd like to rewrite the following lambda function as a regular function so it's more accessible to our current skill levels in Python. I've made a number of attempts, but the combination of map, lambda, and numpy.array all at once is confusing.</p>
  
  <pre><code>data = sc.textFile("hdfs://nameservice1:8020/spark_input/linear_regression/lpsa.data")
  parsedData = data.map(lambda line: array([float(x) for x in line.replace(',', ' ').split(' ')]))
  </code></pre>
  
  <p>Entire program is below. Any help appreciated.</p>
  
  <pre><code>#!/opt/tools/anaconda/bin python
  
  from pyspark import SparkConf, SparkContext
  from pyspark.mllib.regression import LinearRegressionWithSGD
  from numpy import array
  
  conf = SparkConf()
  conf.setMaster("local")
  conf.setAppName("Python - Linear Regression Test")
  conf.set("spark.executor.memory", "1g")
  
  sc = SparkContext(conf = conf)
  
  # Load and parse the data
  
  data = sc.textFile("hdfs://nameservice1:8020/spark_input/linear_regression/lpsa.data")
  parsedData = data.map(lambda line: array([float(x) for x in line.replace(',', ' ').split(' ')]))
  
  # Build the model
  numIterations = 50
  model = LinearRegressionWithSGD.train(parsedData, numIterations)
  
  # Evaluate model on training examples and compute training error
  valuesAndPreds = parsedData.map(lambda point: (point.item(0), model.predict(point.take(range(1, point.size)))))
  
  MSE = valuesAndPreds.map(lambda (v, p): (v-p)**2).reduce(lambda x, y: x + y) / valuesAndPreds.count()
  print("training Mean Squared Error = " + str(MSE))
  </code></pre>