Operation processing record of artificial neural network course in 2021


§ 01 job handling

In the autumn of 2021 artificial neural network The course consists of two classes:

  • Internal courses of Tsinghua University;
  • Courses of Shenzhen Research Institute;

1.1 operation requirements

There are four assignments and a course paper in the whole semester.

1.1.1 requirements for four operations

1.1.2 requirements for small papers

  • Assignment Title: requirements for final essay
  • Assignment Description: the content of the final paper can be in the following three forms:
    • (1) Review type: refer to the review articles in journals or conference papers for some theoretical development directions and projects related to artificial neural networks
      Application technology and new algorithm modes are reviewed. It is suggested that the reference papers involved should not be less than 10.
    • (2) Engineering application type: refer to the research papers of journals or conference papers, combined with their own future subject direction, apply neural network related algorithms to solve engineering problems
      Process application problems. It can include engineering applications, algorithm updates or interdisciplinary applications.
    • (3) Theoretical research type: it can study and discuss the problems related to the algorithm theory involved in the artificial neural network algorithm. For example, the convergence problem, generalization problem and hyperparametric adjustment problem in the training algorithm are studied; Combined with other optimization methods, numerical calculation methods and machine learning methods, a new algorithm theoretical framework is proposed; Or integrate and deeply transform the existing algorithms to form algorithms with new characteristics.

For other requirements, please refer to the explanation of the report in class.


§ 02 operation statistics

Start processing all four submitted assignments today (December 27, 2021),

Download and unzip

Job Download

The homework is packaged and downloaded from the online school, and the homework of the two classes is stored in H:\Teaching\NN2021A respectively.

├─HWSZH
└─HWTSH

Job decompression

Download all job files and many submitted jobs are compressed files. use Bandizip The decompression software extracts them to their respective directories.

▲ Figure 1.1 automatically add and compress to their respective directories


Using Bandizip plus compression software can avoid the format error problem encountered in the previous process of using winzip and WinRAR software. Batch compression can greatly improve the efficiency of compression.

▲ Figure 1.2 decompressing operation files


Download grade registration form

Export student information EXCEL form from Infor.

▲ figure 2.2.1 export student information


Set the header information of student information, as shown below.

▲ figure 2.2.2 student information EXCEL table header


Job processing

according to Artificial neural network operation registration and correction in autumn 2020 Processing method, write a processing program to complete the automatic login of grades.

processing program

#!/usr/local/bin/python
# -*- coding: gbk -*-
#============================================================
# SETSCORE.PY                  -- by Dr. ZhuoQing 2021-01-02
#
# Note:
#============================================================

from head import *
import inforsub

#------------------------------------------------------------
def dropfile2studentid():
    tspdropfile2pastetext()
    pastestr = clipboard.paste()
    strsect = pastestr.split('\\')
    for s in strsect[-1:0:-1]:
        if s.count('_') >= 2:
            if s.split('_')[0].isdigit():
                return s.split('_')[0]
            if s.split('_')[0][0] == 'P':
                return s.split('_')[0]

    return "ERROR"

#------------------------------------------------------------
def setscore(idstr, hwstr, score):
    ret = inforsub.setexcelcellstring(inforsub.tshfile, idstr, hwstr, score)
    if ret >= 0: return 'TS',ret

    ret = inforsub.setexcelcellstring(inforsub.shzhfile, idstr, hwstr, score)
    if ret >= 0: return 'SHZH',ret

    return ' ', -1

#------------------------------------------------------------
def appendscore(idstr, hwstr, score):
    ret = inforsub.appendexcelcellstring(inforsub.tshfile, idstr, hwstr, score)
    if ret >= 0:
        return 'TS',ret

    ret = inforsub.appendexcelcellstring(inforsub.shzhfile, idstr, hwstr, score)
    if ret >= 0:
        return 'SHZH',ret

    return ' ', -1

def showscore(idstr):
    ret = inforsub.showexcelinfor(inforsub.tshfile, idstr)
    if ret >= 0: return 'TS', ret

    ret = inforsub.showexcelinfor(inforsub.shzhfile, idstr)
    if ret >=0: return 'SHZH', ret

    return ' ', -1

#------------------------------------------------------------
if __name__ == "__main__":
    idstr = dropfile2studentid()

    if idstr == 'ERROR':
        printf("No student id is found by drop file !\a")
        exit()

    printf('ID : %s\a'%idstr)

    #--------------------------------------------------------

    hwstr = ''
    scorestr = ''

    printf('Begin Modified:')
    x, y = showscore(idstr)
    printff(x,y)

    if len(sys.argv) > 1:
        hwstr = sys.argv[1]

        if hwstr in "hw1 hw2 hw3 hw4".split():
            hwstr = hwstr.upper()

        if hwstr in "1 2 3 4".split():
            hwstr = "HW%s"%hwstr

        if hwstr == 'note':
            hwstr = 'NOTE'
        if hwstr == 'n':
            hwstr = 'NOTE'

        if hwstr == 'paper':
            hwstr = 'PAPER'
        if hwstr == 'p':
            hwstr = 'PAPER'

        if not hwstr in 'HW1 HW2 HW3 HW4 PAPER NOTE'.split():
            printf('HW string error[%s].\a'%hwstr)
            exit()

    if len(sys.argv) > 2:
        scorestr = sys.argv[2]

    if len(hwstr) > 0:
        if hwstr == 'NOTE':
            appendscore(idstr, 'NOTE', scorestr)
        else: setscore(idstr, hwstr, scorestr)

    #--------------------------------------------------------
    printf("After Modified:")
    showscore(idstr)
    printf(' \a')

#------------------------------------------------------------
#        END OF FILE : SETSCORE.PY
#============================================================
#!/usr/local/bin/python
# -*- coding: gbk -*-
#============================================================
# INFORSUB.PY                  -- by Dr. ZhuoQing 2020-06-18
#
# Note:
#============================================================

from headm import *                 # =
import pandas as pd

#------------------------------------------------------------
tshfile = tspstring2text('TSH')
shzhfile = tspstring2text('SHZH')

HOMEWORK_SHEET       = 'homework'

#------------------------------------------------------------
def showexcel(filename):
    excelfile = pd.read_excel(filename, sheet_name=HOMEWORK_SHEET)
    listdata = excelfile.values.tolist()

    for id,l in enumerate(listdata):
        printff(id, l)

def showexcelinfor(filename, sid):
    excelfile = pd.read_excel(filename, sheet_name=HOMEWORK_SHEET)

    rowid = -1
    for id, content in excelfile.items():
        if id == 'Student number':
            content = [str(s) for s in content]
            if str(sid) in content:
                rowid = content.index(str(sid))
            break

    if rowid < 0:
        return rowid

    printf(excelfile.values.tolist()[rowid])
    return rowid

#------------------------------------------------------------
def setexcelcellstring(filename, sid, col, num):
    excelfile = pd.read_excel(filename, sheet_name=HOMEWORK_SHEET)

    rowid = -1
    for id, content in excelfile.items():
        if id == 'Student number':
            content = [str(s) for s in content]
            if str(sid) in content:
                rowid = content.index(str(sid))
            break

    if rowid < 0:
        return rowid

    printff(rowid, col)

    excelfile[col] = excelfile[col].astype(str)
    excelfile.at[rowid, col] = num

    excelfile.to_excel(filename, sheet_name=HOMEWORK_SHEET, index=False)

    return rowid

#------------------------------------------------------------
def appendexcelcellstring(filename, sid, col, num):
    excelfile = pd.read_excel(filename, sheet_name=HOMEWORK_SHEET)

    rowid = -1
    for id, content in excelfile.items():
        if id == 'Student number':
            content = [str(s) for s in content]
            if str(sid) in content:
                rowid = content.index(str(sid))
            break

    if rowid < 0:
        return rowid

    printff(rowid, col)
    excelfile[col] = excelfile[col].astype(str)

    if excelfile.at[rowid, col] != 'nan':
        excelfile.at[rowid, col] = num + ', ' + excelfile.at[rowid, col]
    else: excelfile.at[rowid, col] = num

    if len(num) == 0: excelfile.at[rowid, col] = ''

    excelfile.to_excel(filename, sheet_name=HOMEWORK_SHEET, index=False)

    return rowid

#------------------------------------------------------------
def getexcelcellstring(filename, sid, col):
    excelfile = pd.read_excel(filename, sheet_name=HOMEWORK_SHEET)

    rowid = -1
    for id, content in excelfile.items():
        if id == 'Student number':
            content = [str(s) for s in content]
            if str(sid) in content:
                rowid = content.index(str(sid))
            break

    if rowid < 0:
        return rowid

#    printff(rowid, col)
#    excelfile[col] = excelfile[col].astype(str)
    return excelfile.at[rowid, col]

#------------------------------------------------------------
if __name__ == "__main__":
#    setexcelcellstring(tshfile, '2020210975', 'HW1', 88)
#    s = getexcelcellstring(tshfile, '2020210975', 'HW1')
#    printf(s)
#    showexcel(shzhfile)
    x=showexcelinfor(shzhfile, '2020280355')
    printf(x)

#------------------------------------------------------------
#        END OF FILE : INFORSUB.PY
#============================================================
#!/usr/local/bin/python
# -*- coding: gbk -*-
#============================================================
# SETALLSCORE.PY                     -- by Dr. ZhuoQing 2021-12-27
#
# Note:
#============================================================

from headm import *                 # =

#------------------------------------------------------------
import inforsub

#------------------------------------------------------------
def dropfile2studentid():
    tspdropfile2pastetext()
    pastestr = clipboard.paste()
    strsect = pastestr.split('\\')

    printf(strsect)

    for s in strsect[-1:0:-1]:
        if s.count('_') >= 1:
            if s.split('_')[0].isdigit():
                return s.split('_')[0]
            if s.split('_')[0][0] == 'P':
                return s.split('_')[0]

    return "ERROR"

#------------------------------------------------------------
def setscore(idstr, hwstr, score):
    ret = inforsub.setexcelcellstring(inforsub.tshfile, idstr, hwstr, score)
    if ret >= 0: return 'TS',ret

    ret = inforsub.setexcelcellstring(inforsub.shzhfile, idstr, hwstr, score)
    if ret >= 0: return 'SHZH',ret

    return ' ', -1

#------------------------------------------------------------
def appendscore(idstr, hwstr, score):
    ret = inforsub.appendexcelcellstring(inforsub.tshfile, idstr, hwstr, score)
    if ret >= 0:
        return 'TS',ret

    ret = inforsub.appendexcelcellstring(inforsub.shzhfile, idstr, hwstr, score)
    if ret >= 0:
        return 'SHZH',ret

    return ' ', -1

def showscore(idstr):
    ret = inforsub.showexcelinfor(inforsub.tshfile, idstr)
    if ret >= 0: return 'TS', ret

    ret = inforsub.showexcelinfor(inforsub.shzhfile, idstr)
    if ret >=0: return 'SHZH', ret

    return ' ', -1


#------------------------------------------------------------
tspdropfile2pastetext()
pastestr = clipboard.paste().split('\n')

#------------------------------------------------------------
id = []

for ps in pastestr:
    pss = ps.split('\\')[-1]
    pss = pss.split('_')[0]
    if len(pss) > 0:
        id.append(pss)

id = list(set(id))
printf(id, len(id))

#------------------------------------------------------------
if __name__ == "__main__":
    hwstr = ''
    scorestr = ''

    if len(sys.argv) < 3:
        printf("Usage: setallscore hw score\a")
        exit()

    #--------------------------------------------------------
    if len(sys.argv) > 1:
        hwstr = sys.argv[1]

        if hwstr in "hw1 hw2 hw3 hw4".split():
            hwstr = hwstr.upper()

        if hwstr in "1 2 3 4".split():
            hwstr = "HW%s"%hwstr

        if hwstr == 'note':
            hwstr = 'NOTE'
        if hwstr == 'n':
            hwstr = 'NOTE'

        if hwstr == 'paper':
            hwstr = 'PAPER'
        if hwstr == 'p':
            hwstr = 'PAPER'

        if not hwstr in 'HW1 HW2 HW3 HW4 PAPER NOTE'.split():
            printf('HW string error[%s].\a'%hwstr)
            exit()

    if len(sys.argv) > 2:
        scorestr = sys.argv[2]


    for idstr in id:
#        printf('Begin Modified:')
#        showscore(idstr)

        if len(hwstr) > 0:
            if hwstr == 'NOTE':
                appendscore(idstr, 'NOTE', scorestr)
            else: setscore(idstr, hwstr, scorestr)

#        printf("After Modified:")
#        showscore(idstr)


id = list(set(id))
printf(id, len(id))
printf('\a')

#------------------------------------------------------------
#        END OF FILE : SETALLSCORE.PY
#============================================================

Keywords: AI Computer Vision Deep Learning

Added by lexx on Wed, 19 Jan 2022 15:30:18 +0200