关于数据仓库中的元数据的问题_数据库的元数据是什么

关于数据仓库中的元数据的问题_数据库的元数据是什么,第1张

介绍新一代的BI分析平台——亦策观数台,增强分析、NLP(支持中文自然语言)、数据管理等。观数台是亦策软件拥有自主知识产权的产品,亦策观数台集合了亦策软件在商业智能(BI)领域多年的经验,精心为中国企业量身定制的本土化、敏捷型、可嵌入的商业智能(BI)平台。

其独特的关联引擎、增强智能等核心技术,是允许每位用户深入全面洞悉数据的下一代可视化分析平台。

它将自助式BI的灵活性提升至一个新的层次,包括自助服务可视化、指导式分析应用和仪表盘、嵌入式分析和报告等。观数台核心功能包括BI、报表、门户管理、数据采集、移动端,可以免费体验。

扩展资料:

想要系统的认知大数据,必须要全面而细致的分解它,着手从三个层面来展开:

第一层面是理论,理论是认知的必经途径,也是被广泛认同和传播的基线。在这里从大数据的特征定义理解行业对大数据的整体描绘和定性;从对大数据价值的探讨来深入解析大数据的珍贵所在;洞悉大数据的发展趋势;从大数据隐私这个特别而重要的视角审视人和数据之间的长久博弈。

第二层面是技术,技术是大数据价值体现的手段和前进的基石。在这里分别从云计算、分布式处理技术、存储技术和感知技术的发展来说明大数据从采集、处理、存储到形成结果的整个过程。

第三层面是实践,实践是大数据的最终价值体现。在这里分别从互联网的大数据,政府的大数据,企业的大数据和个人的大数据四个方面来描绘大数据已经展现的美好景象及即将实现的蓝图。

基于 LSTM 生成古诗

1 语料准备

  一共四万多首古诗,一行一首诗

2 预处理

  将汉字表示为 One-Hot 的形式

  在每行末尾加上 ] 符号是为了标识这首诗已经结束,说明 ] 符号之前的语句和之后的语句是没有关联关系的,后面会舍弃掉包含 ] 符号的训练数据。

      puncs = [']', '[', '(', ')', '{', '}', ':', '《', '》']

    def preprocess_file(Config):

        # 语料文本内容

        files_content = ''

        with open(Configpoetry_file, 'r', encoding='utf-8') as f:

            for line in f:

                # 每行的末尾加上"]"符号代表一首诗结束

                for char in puncs:

                    line = linereplace(char, "")

                files_content += linestrip() + "]"

        words = sorted(list(files_content))

        wordsremove(']')

        counted_words = {}

        for word in words:

            if word in counted_words:

                counted_words[word] += 1

            else:

                counted_words[word] = 1

        # 去掉低频的字

        erase = []

        for key in counted_words:

            if counted_words[key] <= 2:

                eraseappend(key)

        for key in erase:

            del counted_words[key]

        del counted_words[']']

        wordPairs = sorted(counted_wordsitems(), key=lambda x: -x[1])

        words, _ = zip(wordPairs)

        # word到id的映射

        word2num = dict((c, i + 1) for i, c in enumerate(words))

        num2word = dict((i, c) for i, c in enumerate(words))

        word2numF = lambda x: word2numget(x, 0)

        return word2numF, num2word, words, files_content

3 模型参数配置

  class Config(object):

    poetry_file = 'poetrytxt'

    weight_file = 'poetry_modelh5'

    # 根据前六个字预测第七个字

    max_len = 6

    batch_size = 512

    learning_rate = 0001

4 构建模型

  通过 PoetryModel 类实现

      class PoetryModel(object):

        def __init__(self, config):

            pass

        def build_model(self):

            pass

        def sample(self, preds, temperature=10):

            pass

        def generate_sample_result(self, epoch, logs):

            pass

        def predict(self, text):

            pass

        def data_generator(self):

            pass

        def train(self):

            pass

  (1)init 函数

  加载 Config 配置信息,进行语料预处理和模型加载

      def __init__(self, config):

            selfmodel = None

            selfdo_train = True

            selfloaded_model = False

            selfconfig = config

            # 文件预处理

            selfword2numF, selfnum2word, selfwords, selffiles_content = preprocess_file(selfconfig)

            if ospathexists(selfconfigweight_file):

                selfmodel = load_model(selfconfigweight_file)

                selfmodelsummary()

            else:

                selftrain()

            selfdo_train = False

            selfloaded_model = True

  (2)build_model 函数

  GRU 模型建立

      def build_model(self):

            '''建立模型'''

            input_tensor = Input(shape=(selfconfigmax_len,))

            embedd = Embedding(len(selfnum2word)+1, 300, input_length=selfconfigmax_len)(input_tensor)

            lstm = Bidirectional(GRU(128, return_sequences=True))(embedd)

            dropout = Dropout(06)(lstm)

            lstm = Bidirectional(GRU(128, return_sequences=True))(embedd)

            dropout = Dropout(06)(lstm)

            flatten = Flatten()(lstm)

            dense = Dense(len(selfwords), activation='softmax')(flatten)

            selfmodel = Model(inputs=input_tensor, outputs=dense)

            optimizer = Adam(lr=selfconfiglearning_rate)

            selfmodelcompile(loss='categorical_crossentropy', optimizer=optimizer, metrics=['accuracy'])

  (3)sample 函数

      def sample(self, preds, temperature=10):

        preds = npasarray(preds)astype('float64')

        preds = nplog(preds) / temperature

        exp_preds = npexp(preds)

        preds = exp_preds / npsum(exp_preds)

        probas = nprandommultinomial(1, preds, 1)

        return npargmax(probas)

  (4)训练模型

      def generate_sample_result(self, epoch, logs): 

            print("\n==================Epoch {}====================="format(epoch))

            for diversity in [05, 10, 15]:

                print("------------Diversity {}--------------"format(diversity))

                start_index = randomrandint(0, len(selffiles_content) - selfconfigmax_len - 1)

                generated = ''

                sentence = selffiles_content[start_index: start_index + selfconfigmax_len]

                generated += sentence

                for i in range(20):

                    x_pred = npzeros((1, selfconfigmax_len))

                    for t, char in enumerate(sentence[-6:]):

                        x_pred[0, t] = selfword2numF(char)

                    preds = selfmodelpredict(x_pred, verbose=0)[0]

                    next_index = selfsample(preds, diversity)

                    next_char = selfnum2word[next_index]

                    generated += next_char

                    sentence = sentence + next_char

                print(sentence)

  (5)predict 函数

  根据给出的文字,生成诗句

      def predict(self, text):

            if not selfloaded_model:

                return

            with open(selfconfigpoetry_file, 'r', encoding='utf-8') as f:

                file_list = freadlines()

            random_line = randomchoice(file_list)

            # 如果给的text不到四个字,则随机补全

            if not text or len(text) != 4:

                for _ in range(4 - len(text)):

                    random_str_index = randomrandrange(0, len(selfwords))

                    text += selfnum2wordget(random_str_index) if selfnum2wordget(random_str_index) not in [',', '。',

                                                                                                              ','] else selfnum2wordget(

                        random_str_index + 1)

            seed = random_line[-(selfconfigmax_len):-1]

            res = ''

            seed = 'c' + seed

            for c in text:

                seed = seed[1:] + c

                for j in range(5):

                    x_pred = npzeros((1, selfconfigmax_len))

                    for t, char in enumerate(seed):

                        x_pred[0, t] = selfword2numF(char)

                    preds = selfmodelpredict(x_pred, verbose=0)[0]

                    next_index = selfsample(preds, 10)

                    next_char = selfnum2word[next_index]

                    seed = seed[1:] + next_char

                res += seed

            return res

  (6) data_generator 函数

  生成数据,提供给模型训练时使用

        def data_generator(self):

            i = 0

            while 1:

                x = selffiles_content[i: i + selfconfigmax_len]

                y = selffiles_content[i + selfconfigmax_len]

                puncs = [']', '[', '(', ')', '{', '}', ':', '《', '》', ':']

                if len([i for i in puncs if i in x]) != 0:

                    i += 1

                    continue

                if len([i for i in puncs if i in y]) != 0:

                    i += 1

                    continue

                y_vec = npzeros(

                    shape=(1, len(selfwords)),

                    dtype=npbool

                )

                y_vec[0, selfword2numF(y)] = 10

                x_vec = npzeros(

                    shape=(1, selfconfigmax_len),

                    dtype=npint32

                )

                for t, char in enumerate(x):

                    x_vec[0, t] = selfword2numF(char)

                yield x_vec, y_vec

                i += 1

  (7)train 函数

      def train(self):

            #number_of_epoch = len(selffiles_content) // selfconfigbatch_size

            number_of_epoch = 10

            if not selfmodel:

                selfbuild_model()

            selfmodelsummary()

            selfmodelfit_generator(

                generator=selfdata_generator(),

                verbose=True,

                steps_per_epoch=selfconfigbatch_size,

                epochs=number_of_epoch,

                callbacks=[

                    kerascallbacksModelCheckpoint(selfconfigweight_file, save_weights_only=False),

                    LambdaCallback(on_epoch_end=selfgenerate_sample_result)

                ]

            )

5 进行模型训练

  model = PoetryModel(Config)

6 作诗

      text = input("text:")

    sentence = modelpredict(text)

    print(sentence)

学习资料:

《中文自然语言处理入门实战》

恩你的感觉很对就是和心理学有关的NLP是神经语言程序学(Neuro-LinguisticProgramming)的英文缩写。在香港,也有意译为身心语法程式学的。NLP是对人类主观经验的研究。更直白地说,NLP是一种思想的技巧。NLP就是我们用语言来改变身心状态的具体方法。它的创造人找到一些卓越的人,研究他们有一些怎样的程序,总结起来,然后教给其它人。并相信,其它人如果能掌握这些程序,也可以获致成功。

以上就是关于关于数据仓库中的元数据的问题_数据库的元数据是什么全部的内容,包括:关于数据仓库中的元数据的问题_数据库的元数据是什么、中文NLP笔记:11. 基于 LSTM 生成古诗、NLP领域中文vs英文有什么异同点,中文NLP有什么独特的地方等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/sjk/9463632.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-28
下一篇 2023-04-28

发表评论

登录后才能评论

评论列表(0条)

保存