-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCategoryDictionary.py
87 lines (68 loc) · 1.76 KB
/
CategoryDictionary.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import numpy as np
CatName={}
CatName[1]='Vessel'
CatName[2]='V Label'
CatName[3]='V Cork'
CatName[4]='V Parts GENERAL'
CatName[5]='Ignore'
CatName[6]='Liquid GENERAL'
CatName[7]='Liquid Suspension'
CatName[8]='Foam'
CatName[9]='Gel'
CatName[10]='Solid GENERAL'
CatName[11]='Granular'
CatName[12]='Powder'
CatName[13]='Solid Bulk'
CatName[14]='Vapor'
CatName[15]='Other Material'
CatName[16]='Filled'
CatLiquid=6
CatSolid=10
CatFilled=16
CatVParts=4
SolidLabels={9,10,11,12,13}
LiquidLabels={6,7,9}
FilledLabels={6,7,8,9,10,11,12,13,15}
PartsLabels={2,3,4}
CatLossWeight={}
CatLossWeight['Vessel']=1
CatLossWeight['V Label']=0.5
CatLossWeight['V Cork']=0.5
CatLossWeight['V Parts GENERAL']=0.5
CatLossWeight['Ignore']=0
CatLossWeight['Liquid GENERAL']=1
CatLossWeight['Liquid Suspension']=1
CatLossWeight['Foam']=1
CatLossWeight['Gel']=1
CatLossWeight['Solid GENERAL']=1
CatLossWeight['Granular']=1
CatLossWeight['Powder']=1
CatLossWeight['Solid Bulk']=1
CatLossWeight['Vapor']=1
CatLossWeight['Other Material']=1
CatLossWeight['Filled']=1
CatNum={}
CatNum['Vessel']=-1
CatNum['V Label']=-1
CatNum['V Cork']=-1
CatNum['V Parts GENERAL']=-1
CatNum['Ignore']=-1
CatNum['Liquid GENERAL']=-1
CatNum['Liquid Suspension']=-1
CatNum['Foam']=-1
CatNum['Gel']=-1
CatNum['Solid GENERAL']=-1
CatNum['Granular']=-1
CatNum['Powder']=-1
CatNum['Solid Bulk']=-1
CatNum['Vapor']=-1
CatNum['Other Material']=-1
CatNum['Filled']=-1
def NormalizeWeight(SomeWeight=5,MaxWeight=20):
SumExamples=0
for nm in CatNum:
if CatNum[nm] >= 0:
SumExamples+=CatNum[nm]
for nm in CatNum:
if CatNum[nm] > 0:
CatLossWeight[nm]*=np.min([(SumExamples/CatNum[nm]),MaxWeight])