Once we open source the code and if you want to refer to our work, please follow the Joint Institute’s honor code and don’t plagiarize these codes directly.
Please refer to project file.
Example:
def sch_random(round_idx, time_counter):
# set the seed
np.random.seed(round_idx)
# random sample clients
cars = list(channel_data[channel_data['Time'] == time_counter]['Car'])
client_indexes = []
if cars:
client_indexes = list(np.random.choice(cars, max(int(len(cars) / 2), 1), replace=False).ravel())
logger.info("client_indexes = " + str(client_indexes) + "; time_counter = " + str(time_counter))
# random local iterations
local_itr = np.random.randint(2) + 1
s_client_indexes = str(list(client_indexes))[1:-1].replace(',', '')
s_local_itr = str(local_itr)
return s_client_indexes + "," + s_local_itr
- Plz avoid meaningless combination of letters like
a
orabc
when naming variables. Name of variable should be meaningful. - Plz add appropriate indentation and blank lines to your code.
- Plz add enough comments to help others understand your code.
- If there is any hyper parameter in your code or global parameter, plz use
argparse
or create another file calledconfig.py
to store them. For example, config.py and argparse
Here are some simple instructions about how to use Git
.
- If you want to download the whole project, run following command.
git clone https://github.com/zzp1012/VE370-Project2.git
- If you want add files to our local git project and remote git project on
github
, run following command.
# Firstly, plz avoid adding files to master branch on github directly. You can create your own branch locally and remotely.
git branch zzp1012 # create my local branch. Here I name the branch as 'zzp1012'. If you have already created a branch, you can jump to next command.
git checkout zzp1012 # switch to 'zzp1012' branch.
git add * # add all the files to local branch 'zzp1012'.
git commit -m "update" # confirm to add files to local branch 'zzp1012'
git push origin zzp1012 # create branch 'zzp1012' remotely on github and copy your the content on your local branch 'zzp1012' to the remote 'zzp1012'.
- If you want to synchronize files on remote project on
github
, you should run:
git pull origin master # synchronize files on remote master branch.
git pull origin "you branch name" # the 'master' can be replaced by the name of the other branch created on remote project on github, then you can synchronize files on the specific remote branch.
UM-SJTU Joint Institute 交大密西根学院