Example #1
0
#
# 预测房地产价格
#
# author: yafei([email protected])
#
import sys
import codecs
import locale
from dtree_loss import DTreeLoss
from dtree_parameter import DTreeParameter
from dtree_sample import DTreeSample

if __name__ == '__main__':
    param = DTreeParameter()
    sample = DTreeSample()
    sample.load('real-estate.txt')
    dt = DTreeLoss(sample, param)
    dt.train(None)

    feature_map = {
            0: u'结构',
            1: u'装修',
            2: u'周边',
            3: u'地段',
            4: u'绿化',
            5: u'交通',
            6: u'户均车位',
            }
    # 为了输出中文
    locale.setlocale(locale.LC_ALL, '')
    lang, encoding = locale.getdefaultlocale()
Example #2
0
#
# 预测房地产价格
#
# author: yafei([email protected])
#
import sys
import codecs
import locale
from dtree_loss import DTreeLoss
from dtree_parameter import DTreeParameter
from dtree_sample import DTreeSample

if __name__ == '__main__':
    param = DTreeParameter()
    sample = DTreeSample()
    sample.load('real-estate.txt')
    dt = DTreeLoss(sample, param)
    dt.train(None)

    feature_map = {
        0: u'结构',
        1: u'装修',
        2: u'周边',
        3: u'地段',
        4: u'绿化',
        5: u'交通',
        6: u'户均车位',
    }
    # 为了输出中文
    locale.setlocale(locale.LC_ALL, '')
    lang, encoding = locale.getdefaultlocale()
Example #3
0
# 预测weibo粉丝是否是僵尸粉
#
# author: yafei([email protected])
#
import sys
import codecs
import locale
from dtree_gain import DTreeGain
from dtree_parameter import DTreeParameter
from dtree_sample import DTreeSample

if __name__ == '__main__':
    param = DTreeParameter()
    param.split_threshold = 0.93
    sample = DTreeSample()
    sample.load('weibo.txt')
    dt = DTreeGain(sample, param)
    dt.train()

    feature_map = {
            0: u'注册天数',
            1: u'加V',
            2: u'关注',
            3: u'粉丝',
            4: u'微博',
            5: u'收藏',
            6: u'互粉',
            7: u'共同好友',
            8: u'tag数',
            9: u'等级',
            }