def _func_create_model(sessionId, **kwargs): try: from cuml.neighbors.nearest_neighbors_mg import \ NearestNeighborsMG as cumlNN except ImportError: raise_mg_import_exception() handle = get_raft_comm_state(sessionId)["handle"] return cumlNN(handle=handle, **kwargs)
def _func_create_model(sessionId, **kwargs): try: from cuml.neighbors.kneighbors_classifier_mg import \ KNeighborsClassifierMG as cumlKNN except ImportError: raise_mg_import_exception() handle = get_raft_comm_state(sessionId)["handle"] return cumlKNN(handle=handle, **kwargs)
def _func_fit(sessionId, objs, datatype, has_weights, **kwargs): from cuml.cluster.kmeans_mg import KMeansMG as cumlKMeans handle = get_raft_comm_state(sessionId)["handle"] if not has_weights: inp_data = concatenate(objs) inp_weights = None else: inp_data = concatenate([X for X, weights in objs]) inp_weights = concatenate([weights for X, weights in objs]) return cumlKMeans(handle=handle, output_type=datatype, **kwargs).fit(inp_data, sample_weight=inp_weights)
def _func(sessionId, data, verbose, **kwargs): from cuml.cluster.dbscan_mg import DBSCANMG as cumlDBSCAN handle = get_raft_comm_state(sessionId)["handle"] return cumlDBSCAN(handle=handle, verbose=verbose, **kwargs).fit(data, out_dtype=out_dtype)
def _create_model(sessionId, datatype, **kwargs): from cuml.solvers.cd_mg import CDMG handle = get_raft_comm_state(sessionId)["handle"] return CDMG(handle=handle, output_type=datatype, **kwargs)
def _create_model(sessionId, datatype, **kwargs): from cuml.linear_model.linear_regression_mg import LinearRegressionMG handle = get_raft_comm_state(sessionId)["handle"] return LinearRegressionMG(handle=handle, output_type=datatype, **kwargs)
def _create_model(sessionId, model_func, datatype, **kwargs): handle = get_raft_comm_state(sessionId)["handle"] return model_func(handle, datatype, **kwargs)