Example #1
0
#!/bin/python
# coding: utf-8

from FormalContext import *
from CMN import *
import os

OBJNUM = 20
ATTNUM = 20
OA_RATE = 0.3

# 生成随机形式背景
fc = FormalContext()
fc.randomize(OBJNUM, ATTNUM, OA_RATE)
save_FC(fc)

# 准备组合
NUM = max(OBJNUM, ATTNUM)
for i in range(1, NUM+1):
    if not os.path.exists('permutation_%s.dump' % i):
        result = []
        for j in Permutation(i).perm_all():
            result.append(tuple(j))
        pickle.dump(result, open('permutation_%s.dump' % i, 'w'))
print 'OK'
Example #2
0
#!/usr/bin/python
#coding=utf-8
"""godin.py: 主入口调用脚本
@author: Lizzie
@license: ...
@contact: [email protected]
@version: 0.2
"""

from FormalContext import *
from Lattice import Lattice

if __name__ == '__main__':

    fc1 = FormalContext()
    # 随机生成形式背景
    fc1.randomize(20, 10, 0.3)

    # 从文件中读入
    #fc1 = read_FC_file()

    myLattice = Lattice(fc1.object_list, fc1.attribute_list, 0.5, 0.4)
    for obj in range(fc1.object_num):
        myLattice.addOneObject([obj], fc1.oa_value[obj])
    print myLattice
Example #3
0
#!/bin/python
# coding: utf-8

from FormalContext import *
from CMN import *
import os

OBJNUM = 20
ATTNUM = 20
OA_RATE = 0.3

# 生成随机形式背景
fc = FormalContext()
fc.randomize(OBJNUM, ATTNUM, OA_RATE)
save_FC(fc)

# 准备组合
if not os.path.exists('permutation_%s.dump' % OBJNUM):
    result = []
    for j in Permutation(OBJNUM).perm_all():
        result.append(tuple(j))
    pickle.dump(result, open('permutation_%s.dump' % OBJNUM, 'w'))
if not os.path.exists('permutation_%s.dump' % ATTNUM):
    result = []
    for j in Permutation(ATTNUM).perm_all():
        result.append(tuple(j))
    pickle.dump(result, open('permutation_%s.dump' % ATTNUM, 'w'))
print 'OK'
Example #4
0
#coding=utf-8
"""godin.py: 主入口调用脚本
@author: Lizzie
@license: ...
@contact: [email protected]
@version: 0.2
"""

from FormalContext import *
from Lattice import Lattice

if __name__ == '__main__':

    fc = FormalContext()
    # 随机生成形式背景
    fc.randomize(1000, 20, 0.2)

    # 从文件中读入
    fc1 = read_FC_file()

    myLattice = Lattice(fc.object_list, fc.attribute_list)
    for obj in range(fc.object_num):
        myLattice.addOneObject([obj], fc.oa_value[obj])
    #print myLattice
    #str = myLattice.generate_dot_file()
    #print str
    #try:
    #    to_file = file('/home/shengyan/workspace/godin/new/dot/show', 'wa')
    #    to_file.write('BR-----------\n%s\n\n' % BR)
    #    to_file.write('Lattice-----------\n%s\n\n' % myLattice)
    #    dot_file = file('/home/shengyan/workspace/godin/new/dot/show_godin.dot', 'wa')
Example #5
0
"""godin.py: 主入口调用脚本
@author: Lizzie
@license: ...
@contact: [email protected]
@version: 0.2
"""

from FormalContext import *
from Lattice import Lattice

if __name__ == '__main__':
    
    fc = FormalContext()
    # 随机生成形式背景
    fc.randomize(1000, 20, 0.2)
    
    # 从文件中读入
    fc1 = read_FC_file()
    

    myLattice = Lattice(fc.object_list, fc.attribute_list)
    for obj in range(fc.object_num):
        myLattice.addOneObject([obj], fc.oa_value[obj])
    #print myLattice
    #str = myLattice.generate_dot_file()
    #print str
    #try:
    #    to_file = file('/home/shengyan/workspace/godin/new/dot/show', 'wa')
    #    to_file.write('BR-----------\n%s\n\n' % BR)
    #    to_file.write('Lattice-----------\n%s\n\n' % myLattice)
Example #6
0
#!/usr/bin/python
#coding=utf-8

"""godin.py: 主入口调用脚本
@author: Lizzie
@license: ...
@contact: [email protected]
@version: 0.2
"""

from FormalContext import *
from Lattice import Lattice

if __name__ == '__main__':
    
    fc1 = FormalContext()
    # 随机生成形式背景
    fc1.randomize(20, 10, 0.3)
    
    # 从文件中读入
    #fc1 = read_FC_file()
    

    myLattice = Lattice(fc1.object_list, fc1.attribute_list, 0.5, 0.4)
    for obj in range(fc1.object_num):
        myLattice.addOneObject([obj], fc1.oa_value[obj])
    print myLattice