def predict(self, x, distributed=True):
if is_distributed:<EOL><INDENT>if isinstance(x, np.ndarray):<EOL><INDENT>features = to_sample_rdd(x, np.zeros([x.shape[<NUM_LIT:0>]]))<EOL><DEDENT>elif isinstance(x, RDD):<EOL><INDENT>features = x<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>" % type(x))<EOL><DEDENT>return self.predict_distributed(features)<EOL><DEDENT>else:<EOL><INDENT>if isinstance(x, np.ndarray):<EOL><INDENT>return self.predict_local(x)<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>" % type(x))<EOL><DEDENT><DEDENT>
Use a model to do prediction.

# Arguments
x: Input data. A Numpy array or RDD of Sample.
distributed: Boolean. Whether to do prediction in distributed mode or local mode.
             Default is True. In local mode, x must be a Numpy array.