From dc350d77397c576216feab5dd26a928b757c6bd1 Mon Sep 17 00:00:00 2001 From: 17731 <779568335@qq.com> Date: Tue, 3 Dec 2024 16:38:36 +0800 Subject: [PATCH 1/5] add diabetic readmission prediction example for healthcare folder --- .../Diabetic_Readmission_Prediction/README.md | 45 +++ .../train_mlp.py | 265 ++++++++++++++++++ examples/healthcare/data/diabetic.py | 78 ++++++ examples/healthcare/models/diabetic_net.py | 147 ++++++++++ 4 files changed, 535 insertions(+) create mode 100644 examples/healthcare/application/Diabetic_Readmission_Prediction/README.md create mode 100644 examples/healthcare/application/Diabetic_Readmission_Prediction/train_mlp.py create mode 100644 examples/healthcare/data/diabetic.py create mode 100644 examples/healthcare/models/diabetic_net.py diff --git a/examples/healthcare/application/Diabetic_Readmission_Prediction/README.md b/examples/healthcare/application/Diabetic_Readmission_Prediction/README.md new file mode 100644 index 000000000..fbc3ab7e8 --- /dev/null +++ b/examples/healthcare/application/Diabetic_Readmission_Prediction/README.md @@ -0,0 +1,45 @@ + + +# Singa for Diabetic Readmission Prediction task + +## Diabetic Readmission + +Diabetic readmission is a significant concern in healthcare, with a substantial number of patients being readmitted to the hospital within a short period after discharge. This not only leads to increased healthcare costs but also poses a risk to patient well-being. + +Although diabetes is a manageable condition, early identification of patients at high risk of readmission remains a challenge. A reliable and efficient predictive model can help identify these patients, enabling healthcare providers to intervene early and prevent unnecessary readmissions. + +To address this issue, we use Singa to implement a machine learning model for predicting diabetic readmission. The dataset is from [BMC Medical Informatics and Decision-Making](https://bmcmedinformdecismak.biomedcentral.com/articles/10.1186/s12911-021-01423-y). Please download the dataset before running the scripts. + + +## Structure + +* `data` includes the scripts for preprocessing Diabetic Readmission datasets. + +* `model` includes the MLP model construction codes by creating + a subclass of `Module` to wrap the neural network operations + of each model. + +* `train_mlp.py` is the training script, which controls the training flow by + doing BackPropagation and SGD update. + +## Command +```bash +python train_mlp.py mlp diabetic +``` \ No newline at end of file diff --git a/examples/healthcare/application/Diabetic_Readmission_Prediction/train_mlp.py b/examples/healthcare/application/Diabetic_Readmission_Prediction/train_mlp.py new file mode 100644 index 000000000..aeef6b5d4 --- /dev/null +++ b/examples/healthcare/application/Diabetic_Readmission_Prediction/train_mlp.py @@ -0,0 +1,265 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +from singa import device +from singa import tensor +from singa import opt +import numpy as np +import time +import argparse +from healthcare.data import diabetic +from healthcare.models import diabetic_net + +np_dtype = {"float16": np.float16, "float32": np.float32} + +singa_dtype = {"float16": tensor.float16, "float32": tensor.float32} + + +# Calculate accuracy +def accuracy(pred, target): + # y is network output to be compared with ground truth (int) + y = np.argmax(pred, axis=1) + a = y == target + correct = np.array(a, "int").sum() + return correct + + +# Data partition according to the rank +def partition(global_rank, world_size, train_x, train_y, val_x, val_y): + # Partition training data + data_per_rank = train_x.shape[0] // world_size + idx_start = global_rank * data_per_rank + idx_end = (global_rank + 1) * data_per_rank + train_x = train_x[idx_start:idx_end] + train_y = train_y[idx_start:idx_end] + + # Partition evaluation data + data_per_rank = val_x.shape[0] // world_size + idx_start = global_rank * data_per_rank + idx_end = (global_rank + 1) * data_per_rank + val_x = val_x[idx_start:idx_end] + val_y = val_y[idx_start:idx_end] + return train_x, train_y, val_x, val_y + + +# Function to all reduce NUMPY accuracy and loss from multiple devices +def reduce_variable(variable, dist_opt, reducer): + reducer.copy_from_numpy(variable) + dist_opt.all_reduce(reducer.data) + dist_opt.wait() + output = tensor.to_numpy(reducer) + return output + + +def run(global_rank, + world_size, + local_rank, + max_epoch, + batch_size, + model, + data, + sgd, + graph, + verbosity, + dist_option='plain', + spars=None, + precision='float32'): + dev = device.create_cpu_device() # now CPU version only, could change to GPU device for GPU-support machines + dev.SetRandSeed(0) + np.random.seed(0) + + # Load data based on specified dataset + if data == 'diabetic': + train_x, train_y, val_x, val_y = diabetic.load() + elif data == 'mnist' or data == 'cifar10' or data == 'cifar100': + raise ValueError("Only 'diabetic' dataset (2D table data) is supported with MLP model.") + + # Ensure the data is already 2D (train_x.shape[1:] should have only one dimension) + data_size = train_x.shape[1] + num_classes = int(np.max(train_y) + 1) + + # Initialize MLP model + if model == 'mlp': + model = diabetic_net.create_model(data_size=data_size, + num_classes=num_classes) + else: + print( + 'Wrong model!' + ) + sys.exit(0) + # Setup distributed training flags + if hasattr(sgd, "communicator"): + DIST = True + sequential = True + else: + DIST = False + sequential = False + + # Partition data if distributed training is used + if DIST: + train_x, train_y, val_x, val_y = partition(global_rank, world_size, + train_x, train_y, val_x, + val_y) + + # Define tensors for inputs and labels + tx = tensor.Tensor((batch_size, data_size), dev, singa_dtype[precision]) + ty = tensor.Tensor((batch_size,), dev, tensor.int32) + + num_train_batch = train_x.shape[0] // batch_size + num_val_batch = val_x.shape[0] // batch_size + idx = np.arange(train_x.shape[0], dtype=np.int32) + + # Attach optimizer to model + model.set_optimizer(sgd) + model.compile([tx], is_train=True, use_graph=graph, sequential=sequential) + dev.SetVerbosity(verbosity) + + # Training and evaluation loop + for epoch in range(max_epoch): + start_time = time.time() + np.random.shuffle(idx) + + if global_rank == 0: + print('Starting Epoch %d:' % epoch) + + # Training phase + train_correct = np.zeros(shape=[1], dtype=np.float32) + test_correct = np.zeros(shape=[1], dtype=np.float32) + train_loss = np.zeros(shape=[1], dtype=np.float32) + + model.train() + for b in range(num_train_batch): + x = train_x[idx[b * batch_size:(b + 1) * batch_size]] + y = train_y[idx[b * batch_size:(b + 1) * batch_size]] + + x = x.astype(np_dtype[precision]) # Ensure correct precision + tx.copy_from_numpy(x) + ty.copy_from_numpy(y) + + # Train the model + out, loss = model(tx, ty, dist_option, spars) + train_correct += accuracy(tensor.to_numpy(out), y) + train_loss += tensor.to_numpy(loss)[0] + + if DIST: + # Reduce training stats across distributed devices + reducer = tensor.Tensor((1,), dev, tensor.float32) + train_correct = reduce_variable(train_correct, sgd, reducer) + train_loss = reduce_variable(train_loss, sgd, reducer) + + if global_rank == 0: + print('Training loss = %f, training accuracy = %f' % + (train_loss, train_correct / + (num_train_batch * batch_size * world_size)), + flush=True) + + # Evaluation phase + model.eval() + for b in range(num_val_batch): + x = val_x[b * batch_size:(b + 1) * batch_size] + y = val_y[b * batch_size:(b + 1) * batch_size] + + x = x.astype(np_dtype[precision]) + tx.copy_from_numpy(x) + ty.copy_from_numpy(y) + + out_test = model(tx) + test_correct += accuracy(tensor.to_numpy(out_test), y) + + if DIST: + # Reduce evaluation stats across distributed devices + test_correct = reduce_variable(test_correct, sgd, reducer) + + if global_rank == 0: + print('Evaluation accuracy = %f, Elapsed Time = %fs' % + (test_correct / (num_val_batch * batch_size * world_size), + time.time() - start_time), + flush=True) + + dev.PrintTimeProfiling() + + + +if __name__ == '__main__': + # Use argparse to get command config: max_epoch, model, data, etc., for single gpu training + parser = argparse.ArgumentParser( + description='Training using the autograd and graph.') + parser.add_argument( + 'model', + choices=['cnn', 'resnet', 'xceptionnet', 'mlp', 'alexnet'], + default='mlp') + parser.add_argument('data', + choices=['mnist', 'cifar10', 'cifar100', 'diabetic'], + default='mnist') + parser.add_argument('-p', + choices=['float32', 'float16'], + default='float32', + dest='precision') + parser.add_argument('-m', + '--max-epoch', + default=100, + type=int, + help='maximum epochs', + dest='max_epoch') + parser.add_argument('-b', + '--batch-size', + default=64, + type=int, + help='batch size', + dest='batch_size') + parser.add_argument('-l', + '--learning-rate', + default=0.005, + type=float, + help='initial learning rate', + dest='lr') + # Determine which gpu to use + parser.add_argument('-i', + '--device-id', + default=0, + type=int, + help='which GPU to use', + dest='device_id') + parser.add_argument('-g', + '--disable-graph', + default='True', + action='store_false', + help='disable graph', + dest='graph') + parser.add_argument('-v', + '--log-verbosity', + default=0, + type=int, + help='logging verbosity', + dest='verbosity') + + args = parser.parse_args() + + sgd = opt.SGD(lr=args.lr, momentum=0.9, weight_decay=1e-5, dtype=singa_dtype[args.precision]) + run(0, + 1, + args.device_id, + args.max_epoch, + args.batch_size, + args.model, + args.data, + sgd, + args.graph, + args.verbosity, + precision=args.precision) \ No newline at end of file diff --git a/examples/healthcare/data/diabetic.py b/examples/healthcare/data/diabetic.py new file mode 100644 index 000000000..e7f2a76b7 --- /dev/null +++ b/examples/healthcare/data/diabetic.py @@ -0,0 +1,78 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +from ucimlrepo import fetch_ucirepo +from sklearn.model_selection import train_test_split +import pandas as pd +import numpy as np + + +def load_dataset(columns_to_encode=None, flag=True): + """ + Load the dataset and apply one-hot encoding to features (all columns or specific columns). + Targets will first be one-hot encoded and then converted to categorical integer labels. + + Parameters: + columns_to_encode (list or None): List of column names to be one-hot encoded. + If None and `flag=True`, all columns are encoded. + flag (bool): Whether to apply one-hot encoding to all columns. + If True, `columns_to_encode` will be ignored, and all columns will be processed. + + Returns: + train_x, train_y, test_x, test_y (numpy.ndarray): + Train features, train labels, test features, and test labels in NumPy array format. + """ + # Load the dataset + diabetes_data = fetch_ucirepo(id=296) + + # Extract features and targets + features = diabetes_data.data.features + targets = diabetes_data.data.targets + + # Apply one-hot encoding to features + if flag or columns_to_encode is None: + features_encoded = pd.get_dummies(features, drop_first=True) + else: + features_encoded = pd.get_dummies(features, columns=columns_to_encode, drop_first=True) + + # One-hot encode targets and convert to a single categorical variable + targets_encoded = pd.get_dummies(targets, drop_first=False) + targets_categorical = targets_encoded.idxmax(axis=1) # Get the column name with the max value (One-Hot index) + targets_categorical = targets_categorical.astype('category').cat.codes # Convert to integer codes + + # Convert to NumPy arrays + features_np = features_encoded.to_numpy(dtype=np.float32) + targets_np = targets_categorical.to_numpy(dtype=np.float32) + + # Split the data + train_x, test_x, train_y, test_y = train_test_split( + features_np, targets_np, test_size=0.2, random_state=42 + ) + + return train_x, train_y, test_x, test_y + + + +def load(): + train_x, train_y, val_x, val_y = load_dataset() + train_x = train_x.astype(np.float32) + val_x = val_x.astype(np.float32) + train_y = train_y.astype(np.int32) + val_y = val_y.astype(np.int32) + return train_x, train_y, val_x, val_y \ No newline at end of file diff --git a/examples/healthcare/models/diabetic_net.py b/examples/healthcare/models/diabetic_net.py new file mode 100644 index 000000000..83874c896 --- /dev/null +++ b/examples/healthcare/models/diabetic_net.py @@ -0,0 +1,147 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +from singa import layer +from singa import model +from singa import tensor +from singa import opt +from singa import device +import argparse +import numpy as np + +np_dtype = {"float16": np.float16, "float32": np.float32} + +singa_dtype = {"float16": tensor.float16, "float32": tensor.float32} + + +class MLP(model.Model): + + def __init__(self, data_size=10, perceptron_size=100, num_classes=10): + super(MLP, self).__init__() + self.num_classes = num_classes + self.dimension = 2 + + self.relu = layer.ReLU() + self.linear1 = layer.Linear(perceptron_size) + self.linear2 = layer.Linear(num_classes) + self.softmax_cross_entropy = layer.SoftMaxCrossEntropy() + + def forward(self, inputs): + y = self.linear1(inputs) + y = self.relu(y) + y = self.linear2(y) + return y + + def train_one_batch(self, x, y, dist_option, spars): + out = self.forward(x) + loss = self.softmax_cross_entropy(out, y) + + if dist_option == 'plain': + self.optimizer(loss) + elif dist_option == 'half': + self.optimizer.backward_and_update_half(loss) + elif dist_option == 'partialUpdate': + self.optimizer.backward_and_partial_update(loss) + elif dist_option == 'sparseTopK': + self.optimizer.backward_and_sparse_update(loss, + topK=True, + spars=spars) + elif dist_option == 'sparseThreshold': + self.optimizer.backward_and_sparse_update(loss, + topK=False, + spars=spars) + return out, loss + + def set_optimizer(self, optimizer): + self.optimizer = optimizer + + +def create_model(pretrained=False, **kwargs): + """Constructs a CNN model. + + Args: + pretrained (bool): If True, returns a pre-trained model. + + Returns: + The created CNN model. + """ + model = MLP(**kwargs) + + return model + + +__all__ = ['MLP', 'create_model'] + +if __name__ == "__main__": + np.random.seed(0) + + parser = argparse.ArgumentParser() + parser.add_argument('-p', + choices=['float32', 'float16'], + default='float32', + dest='precision') + parser.add_argument('-g', + '--disable-graph', + default='True', + action='store_false', + help='disable graph', + dest='graph') + parser.add_argument('-m', + '--max-epoch', + default=1001, + type=int, + help='maximum epochs', + dest='max_epoch') + args = parser.parse_args() + + # generate the boundary + f = lambda x: (5 * x + 1) + bd_x = np.linspace(-1.0, 1, 200) + bd_y = f(bd_x) + + # generate the training data + x = np.random.uniform(-1, 1, 400) + y = f(x) + 2 * np.random.randn(len(x)) + + # choose one precision + precision = singa_dtype[args.precision] + np_precision = np_dtype[args.precision] + + # convert training data to 2d space + label = np.asarray([5 * a + 1 > b for (a, b) in zip(x, y)]).astype(np.int32) + data = np.array([[a, b] for (a, b) in zip(x, y)], dtype=np_precision) + + dev = device.create_cuda_gpu_on(0) + sgd = opt.SGD(0.1, 0.9, 1e-5, dtype=singa_dtype[args.precision]) + tx = tensor.Tensor((400, 2), dev, precision) + ty = tensor.Tensor((400,), dev, tensor.int32) + model = MLP(data_size=2, perceptron_size=3, num_classes=2) + + # attach model to graph + model.set_optimizer(sgd) + model.compile([tx], is_train=True, use_graph=args.graph, sequential=True) + model.train() + + for i in range(args.max_epoch): + tx.copy_from_numpy(data) + ty.copy_from_numpy(label) + out, loss = model(tx, ty, 'fp32', spars=None) + + if i % 100 == 0: + print("training loss = ", tensor.to_numpy(loss)[0]) \ No newline at end of file From 8e2aafd3c725737ab7ba2e4579bbd9177d98bb40 Mon Sep 17 00:00:00 2001 From: 17731 <779568335@qq.com> Date: Tue, 3 Dec 2024 17:09:44 +0800 Subject: [PATCH 2/5] add diabetic readmission prediction example for healthcare folder --- .../application/Diabetic_Readmission_Prediction/README.md | 2 +- .../Diabetic_Readmission_Prediction/{train_mlp.py => train.py} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename examples/healthcare/application/Diabetic_Readmission_Prediction/{train_mlp.py => train.py} (100%) diff --git a/examples/healthcare/application/Diabetic_Readmission_Prediction/README.md b/examples/healthcare/application/Diabetic_Readmission_Prediction/README.md index fbc3ab7e8..f0a72a86c 100644 --- a/examples/healthcare/application/Diabetic_Readmission_Prediction/README.md +++ b/examples/healthcare/application/Diabetic_Readmission_Prediction/README.md @@ -41,5 +41,5 @@ To address this issue, we use Singa to implement a machine learning model for pr ## Command ```bash -python train_mlp.py mlp diabetic +python train.py mlp diabetic ``` \ No newline at end of file diff --git a/examples/healthcare/application/Diabetic_Readmission_Prediction/train_mlp.py b/examples/healthcare/application/Diabetic_Readmission_Prediction/train.py similarity index 100% rename from examples/healthcare/application/Diabetic_Readmission_Prediction/train_mlp.py rename to examples/healthcare/application/Diabetic_Readmission_Prediction/train.py From 8765541a7d40d1a0b09e1a66f23a3bf1a9d60550 Mon Sep 17 00:00:00 2001 From: 17731 <779568335@qq.com> Date: Wed, 25 Dec 2024 17:27:01 +0800 Subject: [PATCH 3/5] add run.sh for diabetic readmission prediction example --- .../Diabetic_Readmission_Prediction/run.sh | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 examples/healthcare/application/Diabetic_Readmission_Prediction/run.sh diff --git a/examples/healthcare/application/Diabetic_Readmission_Prediction/run.sh b/examples/healthcare/application/Diabetic_Readmission_Prediction/run.sh new file mode 100644 index 000000000..0cb9797df --- /dev/null +++ b/examples/healthcare/application/Diabetic_Readmission_Prediction/run.sh @@ -0,0 +1,20 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +### diabetic dataset +python train.py mlp diabetic From 559a16b1a92f1dd13d8e1a667456677011b67901 Mon Sep 17 00:00:00 2001 From: npcmaci <779568335@qq.com> Date: Fri, 7 Feb 2025 13:51:40 +0800 Subject: [PATCH 4/5] Merge Diabetic Readmission and Diabetic Retinopathy into Diabetic Disease. --- .../Diabetic_Readmission_Prediction/README.md | 0 .../Diabetic_Readmission_Prediction/run.sh | 0 .../Diabetic_Readmission_Prediction/train.py | 3 +++ .../Diabetic_Retinopathy_Classification/README.md | 0 .../Diabetic_Retinopathy_Classification/run.sh | 0 .../Diabetic_Retinopathy_Classification/train.py | 2 +- 6 files changed, 4 insertions(+), 1 deletion(-) rename examples/healthcare/application/{ => Diabetic_Disease}/Diabetic_Readmission_Prediction/README.md (100%) rename examples/healthcare/application/{ => Diabetic_Disease}/Diabetic_Readmission_Prediction/run.sh (100%) rename examples/healthcare/application/{ => Diabetic_Disease}/Diabetic_Readmission_Prediction/train.py (99%) rename examples/healthcare/application/{ => Diabetic_Disease}/Diabetic_Retinopathy_Classification/README.md (100%) rename examples/healthcare/application/{ => Diabetic_Disease}/Diabetic_Retinopathy_Classification/run.sh (100%) rename examples/healthcare/application/{ => Diabetic_Disease}/Diabetic_Retinopathy_Classification/train.py (99%) diff --git a/examples/healthcare/application/Diabetic_Readmission_Prediction/README.md b/examples/healthcare/application/Diabetic_Disease/Diabetic_Readmission_Prediction/README.md similarity index 100% rename from examples/healthcare/application/Diabetic_Readmission_Prediction/README.md rename to examples/healthcare/application/Diabetic_Disease/Diabetic_Readmission_Prediction/README.md diff --git a/examples/healthcare/application/Diabetic_Readmission_Prediction/run.sh b/examples/healthcare/application/Diabetic_Disease/Diabetic_Readmission_Prediction/run.sh similarity index 100% rename from examples/healthcare/application/Diabetic_Readmission_Prediction/run.sh rename to examples/healthcare/application/Diabetic_Disease/Diabetic_Readmission_Prediction/run.sh diff --git a/examples/healthcare/application/Diabetic_Readmission_Prediction/train.py b/examples/healthcare/application/Diabetic_Disease/Diabetic_Readmission_Prediction/train.py similarity index 99% rename from examples/healthcare/application/Diabetic_Readmission_Prediction/train.py rename to examples/healthcare/application/Diabetic_Disease/Diabetic_Readmission_Prediction/train.py index a51b4b059..7d18cb0e8 100644 --- a/examples/healthcare/application/Diabetic_Readmission_Prediction/train.py +++ b/examples/healthcare/application/Diabetic_Disease/Diabetic_Readmission_Prediction/train.py @@ -23,9 +23,12 @@ import numpy as np import time import argparse +import sys +sys.path.append("../../../..") from healthcare.data import diabetic from healthcare.models import diabetic_net + np_dtype = {"float16": np.float16, "float32": np.float32} singa_dtype = {"float16": tensor.float16, "float32": tensor.float32} diff --git a/examples/healthcare/application/Diabetic_Retinopathy_Classification/README.md b/examples/healthcare/application/Diabetic_Disease/Diabetic_Retinopathy_Classification/README.md similarity index 100% rename from examples/healthcare/application/Diabetic_Retinopathy_Classification/README.md rename to examples/healthcare/application/Diabetic_Disease/Diabetic_Retinopathy_Classification/README.md diff --git a/examples/healthcare/application/Diabetic_Retinopathy_Classification/run.sh b/examples/healthcare/application/Diabetic_Disease/Diabetic_Retinopathy_Classification/run.sh similarity index 100% rename from examples/healthcare/application/Diabetic_Retinopathy_Classification/run.sh rename to examples/healthcare/application/Diabetic_Disease/Diabetic_Retinopathy_Classification/run.sh diff --git a/examples/healthcare/application/Diabetic_Retinopathy_Classification/train.py b/examples/healthcare/application/Diabetic_Disease/Diabetic_Retinopathy_Classification/train.py similarity index 99% rename from examples/healthcare/application/Diabetic_Retinopathy_Classification/train.py rename to examples/healthcare/application/Diabetic_Disease/Diabetic_Retinopathy_Classification/train.py index 5ef41851a..9f17cb495 100644 --- a/examples/healthcare/application/Diabetic_Retinopathy_Classification/train.py +++ b/examples/healthcare/application/Diabetic_Disease/Diabetic_Retinopathy_Classification/train.py @@ -6,7 +6,7 @@ import time import argparse import sys -sys.path.append("../../..") +sys.path.append("../../../..") from PIL import Image From 7865e0a256bce4580b6372e09d466653cb09cb00 Mon Sep 17 00:00:00 2001 From: npcmaci <779568335@qq.com> Date: Fri, 7 Feb 2025 17:56:31 +0800 Subject: [PATCH 5/5] Correct the README file for Diabetic Readmission. --- .../Diabetic_Disease/Diabetic_Readmission_Prediction/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/healthcare/application/Diabetic_Disease/Diabetic_Readmission_Prediction/README.md b/examples/healthcare/application/Diabetic_Disease/Diabetic_Readmission_Prediction/README.md index 4bca2070a..f0cea4738 100644 --- a/examples/healthcare/application/Diabetic_Disease/Diabetic_Readmission_Prediction/README.md +++ b/examples/healthcare/application/Diabetic_Disease/Diabetic_Readmission_Prediction/README.md @@ -41,5 +41,5 @@ To address this issue, we use Singa to implement a machine learning model for pr ## Command ```bash -python train_mlp.py mlp diabetic +python train.py mlp diabetic ```