Example #1
0
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 23 12:37:57 2016
@author: Zhao Cheng
__version__ = '0.1.1'
To config logstash
"""
import logging

logging.basicConfig(level=logging.INFO)
import config_default
import base

logstash = config_default.logstash

try:
    from . import config_override
    base.merge(logstash, config_overrides.logstash)
    logging.info('Get the config_override')
except ImportError:
    logging.info('config_override not exist')
from sklearn import svm
from base import traversalDir_FirstDir, merge
from get_data import z_norm

if __name__ == "__main__":

    # 读取地影属性
    diying_attribute = list(
        pd.read_csv("./parameter/diying.csv", header=None)[0])
    for i in range(len(diying_attribute)):
        diying_attribute[i] = "BX0101_" + diying_attribute[i]

    # 训练集数据读取
    read_path_train = "./data/train"
    file_path_list = traversalDir_FirstDir(read_path_train)
    train_data = merge(file_path_list)[diying_attribute]
    train_data["Class"] = 0

    # 验证集数据读取
    read_path_val = "./data/val"
    file_path_list = traversalDir_FirstDir(read_path_val)
    val_data = merge(file_path_list)[diying_attribute]
    read_path_val = "./data/val_set"
    file_path_list = traversalDir_FirstDir(read_path_val)
    sources = np.zeros((141017, 24))
    for i in range(len(file_path_list)):
        data = pd.read_csv(file_path_list[i], engine="python")["Class"]
        sources[:, i] = data.values
    sources = np.sum(sources, axis=1)
    source_label = [1 if source > 0 else 0 for source in sources]
    val_data["Class"] = source_label
Example #3
0
def get_vm_ouput():
    name = '虚拟机信息'
    list_path = ['data/*vm.csv']
    list_sheet = ['虚拟机信息']
    merge(name, list_path, list_sheet)
    return None
Example #4
0
        result.append(data[i: i+sequence_length])
    result = np.array(result) # shape (samples, sequence_length)

    X = result[:, 0:-1]
    Y = result[:, -1]

    X = np.reshape(X, (X.shape[0], X.shape[1], 1))
    return X, Y


if __name__ == "__main__":

    # 绘制正常数据曲线及其预测曲线
    read_path = r"./data/train"
    read_file_list = traversalDir_FirstDir(read_path)
    data = merge(read_file_list)
    data.set_index(["Time"], inplace=True)
    diying_attribute = list(pd.read_csv("./parameter/diying.csv", header=None)[0])
    for i in range(len(diying_attribute)):
        diying_attribute[i] = "BX0101_" + diying_attribute[i]
    data = data[diying_attribute]
    # data = data.iloc[0:9000, :]

    for i in range(data.shape[0]):
        data_copy = data.iloc[:, i:i+1].copy()
        data.iloc[:, i:i+1] = z_norm(data_copy)
        tmp = data.iloc[:, i].values
        plt.plot(tmp[5000:20000], c="b")
        # tmp_x, tmp_y = test_GetData(tmp)
        # new_model = load_model('./model/' + data.columns[i] + ".h5")
        # result = new_model.predict(tmp_x, batch_size=256)
Example #5
0
def check_output():
    name = '虚拟平台巡检附件'
    list_path = ['data/*VmHost.csv', 'data/*Datastore.csv', 'data/*Alarm.csv']
    list_sheet = ['宿主机巡检结果', '存储巡检结果', '告警次数']
    merge(name, list_path, list_sheet)
    return None
Example #6
0
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 23 12:37:57 2016
@author: Zhao Cheng
__version__ = '0.1.1'
To config logstash
"""
import logging; logging.basicConfig(level=logging.INFO)
import config_default
import base

logstash = config_default.logstash

try:
    from . import config_override
    base.merge(logstash, config_overrides.logstash)
    logging.info('Get the config_override')
except ImportError:
    logging.info('config_override not exist')