def _toSparkGLM(self, model):
skl_cls = type(model)<EOL>py_cls = self._skl2spark_classes[skl_cls].py<EOL>jvm_cls_name = self._skl2spark_classes[skl_cls].jvm<EOL>intercept = model.intercept_<EOL>weights = model.coef_<EOL>if len(np.shape(weights)) == <NUM_LIT:1>or (len(np.shape(weights)) == <NUM_LIT:2> and np.shape(weights)[<NUM_LIT:0>] == <NUM_LIT:1>):<EOL><INDENT>uid = _randomUID(skl_cls)<EOL>_java_model = _new_java_obj(self.sc, jvm_cls_name, uid, Vectors.dense(weights), float(intercept))<EOL>return py_cls(_java_model)<EOL><DEDENT>elif len(np.shape(weights)) == <NUM_LIT:2> and skl_cls == SKL_LogisticRegression:<EOL><INDENT>raise ValueError("<STR_LIT>" +<EOL>"<STR_LIT>" +<EOL>"<STR_LIT>" %<EOL>np.shape(weights)[<NUM_LIT:0>])<EOL><DEDENT>else:<EOL><INDENT>raise Exception("<STR_LIT>" +<EOL>"<STR_LIT>" + type(model) + "<STR_LIT:U+0020>" + len(np.shape(weights)))<EOL><DEDENT>
Private method for converting a GLM to a Spark model
        TODO: Add model parameters as well.