-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathparser.py
39 lines (31 loc) · 1.15 KB
/
parser.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
from __future__ import division, print_function
from feature_tree import FeatureTree
from products_tree import ProductSet
import random
import pdb
def loadFeatures():
# Step 1. Load SPLIT model. Use load_ft_from_url()
url = "C:/Users/salah.ghamizi/Downloads/pledge-master/tensorflow//NAS Model.xml"
ft = FeatureTree()
ft.load_ft_from_url(url)
# Step 2. Check feature model information
print('This model has/n'
' {0} constraints/n'
' {1} features/n'
' {2} depth'.format(
ft.get_cons_num(),
ft.get_feature_num(),
ft.get_tree_height()
))
def loadProducts():
url = "C:/Users/salah.ghamizi/Downloads/pledge-master/tensorflow//NAS Products.pdt"
productSet = ProductSet(url)
print("number of features {0}, number of products: {1}".format(productSet.nbFeatures, productSet.nbProducts))
rand_product = productSet.format_product(2)#random.randrange(0, productSet.nbProducts-1))
print((rand_product))
products = productSet.format_products()
for i, prd in enumerate(products):
if len(prd) < 10:
print("{0}:{1}".format(i, len(prd)))
if __name__ == '__main__':
loadProducts()