def test_read_csv(): import nums from nums.core import settings settings.system_name = "serial" filename = settings.pj(settings.project_root, "tests", "core", "storage", "test.csv") ba = nums.read_csv(filename, has_header=True) assert np.allclose(ba[0].get(), [123, 4, 5]) assert np.allclose(ba[-1].get(), [1.2, 3.4, 5.6])
def test_modin(nps_app_inst): import nums import nums.numpy as nps import modin.pandas as mpd from nums.core import settings from nums.core.systems.systems import RaySystem if not isinstance(nps_app_inst.cm.system, RaySystem): return filename = settings.pj(settings.project_root, "tests", "core", "storage", "test.csv") ba1 = nums.read_csv(filename, has_header=True) df = mpd.read_csv(filename) ba2: BlockArray = nums.from_modin(df) assert nps.allclose(ba1, ba2)
dtype=nps.int.__name__, ), cm, ) for grid_entry in X.grid.get_entry_iterator(): i = grid_entry[0] X_block: Block = X.blocks[grid_entry] r_block: Block = result.blocks[i] syskwargs = { "grid_entry": grid_entry, "grid_shape": X.grid.grid_shape } r_block.oid = cm.call("xgb_predict", model_block.oid, X_block.oid, syskwargs=syskwargs) return result if __name__ == "__main__": from nums.core import settings import nums filename = settings.pj(settings.project_root, "tests", "core", "storage", "test.csv") X: BlockArray = nums.read_csv(filename, has_header=True) y: BlockArray = nps.random.random_sample(X.shape[0]) model = XGBClassifier() model.fit(X, y) print(model.predict(X).get())