ICode9

精准搜索请尝试: 精确搜索
  • 对于scipy.sparse.csr_matrix的一点解释2021-10-01 15:30:52

    csr_matrix的API reference是这样写的:scipy.sparse.csr_matrix — SciPy v1.7.1 Manualhttps://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.html#:~:text=csr_matrix%20%28%28data%2C%20indices%2C%20indptr%29%2C%20%5Bshape%3D%20%28M%2C%20N%29%

  • CF1009F Dominant Indices2021-09-13 17:35:51

    长链剖分 一个dp dp[i][j]距离i节点的子树中为j的节点数 #include<bits/stdc++.h> using namespace std; const int N=1e6+7; //长链剖分 int head[N],nxt[N<<1],to[N<<1]; int _; void add(int x,int y) { _++; to[_]=y; nxt[_]=head[x]; head[x]=_;

  • LeetCode 387:字符串中的第一个唯一字符2021-09-12 19:58:42

    给定一个字符串,找到它的第一个不重复的字符,并返回它的索引。如果不存在,则返回 -1。 建立一个哈希表,索引为字母,如果字母没有出现,值为-2;如果字母出现多次,值为-1;如果字母只出现一次,值为出现的位置。 class Solution { public: int firstUniqChar(const string& s) { v

  • 深度学习pytorch学习笔记2021-09-07 20:59:39

    深度学习pytorch学习笔记 关于语言模型数据集预处理章节的代码解释 模块 # 导入模块 import torch import random import zipfile 读取数据 # 打开压缩包,读取数据 with zipfile.ZipFile('D:/dataset/data_jaychou_lyrics.txt.zip') as zin: with zin.open('jaychou_lyr

  • [LeetCode] 833. Find And Replace in String_Medium tag: array2021-08-12 02:00:25

    Y ou are given a 0-indexed string s that you must perform k replacement operations on. The replacement operations are given as three 0-indexed parallel arrays, indices, sources, and targets, all of length k. To complete the ith replacement opera

  • 820. 单词的压缩编码2021-07-22 01:03:30

    题目描述 单词数组 words 的 有效编码 由任意助记字符串 s 和下标数组 indices 组成,且满足: words.length == indices.length 助记字符串 s 以 '#' 字符结尾 对于每个下标 indices[i] ,s 的一个从 indices[i] 开始、到下一个 '#' 字符结束(但不包括 '#')的 子字符串 恰好与 words[i]

  • Leetcode 833. Find And Replace in String2021-07-21 16:32:15

    文章作者:Tyan 博客:noahsnail.com  |  CSDN  |  简书 1. Description 2. Solution **解析:**Version 1,先排序,根据索引排序,对源字符串和目标字符串也根据索引的排序顺序排序,这样做主要为了判断是否有重叠字符串。遍历所有索引,如果当前索引加上源字符串的长度与下一个索引重

  • leetcode 820. 单词的压缩编码2021-07-21 11:36:33

    单词数组 words 的 有效编码 由任意助记字符串 s 和下标数组 indices 组成,且满足: words.length == indices.length助记字符串 s 以 '#' 字符结尾对于每个下标 indices[i] ,s 的一个从 indices[i] 开始、到下一个 '#' 字符结束(但不包括 '#')的 子字符串 恰好与 words[i] 相等给你一

  • Matlab:将数据按比例随机划分2021-07-14 10:01:47

    将10行数据随机划分为5份,将其中1份作为测试集,另4份作为训练集 1. 随机生成10维1:5等数量随机数 m = 10; k=5; data = [1;2;3;4;5;6;7;8;9;10]; indices = crossvalind('Kfold',m,k) output indices = 10×1 1 2 1 3 2 4 5 5 4

  • Prometheus监控Elasticsearch2021-07-07 12:53:11

    一、安装监控插件elasticsearch_exporter wget https://github.com/prometheus-community/elasticsearch_exporter/releases/download/v1.2.1/elasticsearch_exporter-1.2.1.linux-386.tar.gz tar xf elasticsearch_exporter-1.2.1.linux-386.tar.gz mv elasticsearch_exporter-1.

  • vue-axios传递数组参数2021-07-01 11:03:22

    直接放在对象中传递数组,传递的参数格式如下: 但是这样的话后台是取不到值的,我们需要把数组变成如下这种格式: test:111 test:222 get / delete请求 axios.get(url, { params: { test: [1,2,3], type: 1 }, paramsSerializer: params => { return

  • 【学习笔记】浅谈文本生成中的采样方法2021-06-29 16:32:13

        本文学习记录一下,文本生成过程,以及过程中如何 选择/采样 下一个生成的词。首先将简单介绍一下文本生成(text generation)的完成过程;然后简单介绍下常用的采样(sampling)方法;最后,将实现并讨论以下三种采样方法(Greedy Sampling、Temperature Samling、Top-K采样)的优势和劣势

  • Python 操作Elasticsearch Api2021-06-21 23:31:03

    一. 环境准备: Python 3.8 Elasticsearch 7.5 VirtaulBox 虚拟机客户端CentOs7 参考文档: https://elasticsearch-py.readthedocs.io/en/v7.12.1/transports.html 二. 连接Es 安装依赖包:pip install elasticsearch连接es 方法: # -*- coding=utf8 -*- from elasticsearch im

  • 成功解决TypeError: __init__() got an unexpected keyword argument 'indices'2021-06-16 12:03:30

    成功解决TypeError: __init__() got an unexpected keyword argument 'indices'     目录 解决问题 解决思路 解决方法     解决问题 TypeError: __init__() got an unexpected keyword argument 'indices'       解决思路 类型错误:得到意外的关键字参数“indexs”    

  • 记录一下Elasticsearch踩坑-数据请求的时报错 Data too large, data for [<http_request>]2021-06-09 21:02:12

    1.问题描述 今天在学习elstaticsearch的时候,在请求某一个index下的所有数据时候,请求失败 控制台输出显示 Data too large, data 2.问题分析 请求数据太大,默认配置的elstaticsearch无法处理 3.解决思路 修改~/config/elasticsearch.yml文件 添加以下配置 http.host: 0.0

  • 淼淼刷力扣2021-05-30 21:57:20

    【努力刷力扣】第三十二天 --- 力扣477+1528(string) 引言题目一(1528)要求:整体思路一:具体代码一(内附注释):整体思路二:具体代码二(内附注释): 题目二(477)要求:必备知识解法一:暴力破解(c++必超时,Java可以过)整体按位计数法第一:具体代码(附有注释) 引言 本人初次尝试写博客,希望各位

  • Netty面试常驻题:你知道Netty的零拷贝机制吗?2021-05-25 16:51:56

    理解零拷贝 零拷贝是Netty的重要特性之一,而究竟什么是零拷贝呢?WIKI中对其有如下定义: "Zero-copy" describes computer operations in which the CPU does not perform the task of copying data from one memory area to another. 从WIKI的定义中,我们看到“零拷贝”是指计算机操

  • Netty面试常驻题:你知道Netty的零拷贝机制吗?2021-05-25 16:34:36

    理解零拷贝 零拷贝是Netty的重要特性之一,而究竟什么是零拷贝呢?WIKI中对其有如下定义: "Zero-copy" describes computer operations in which the CPU does not perform the task of copying data from one memory area to another. 从WIKI的定义中,我们看到“零拷贝”是指计算机

  • qs.stringfy序列化处理入参( a:[1,2,3,4] => a=1&a=2&a=3&a=4 )2021-05-18 16:34:50

    在开发中用axios请求时,偶尔需要使用qs对数据做如下处理, a:[1,2,3,4] => a=1&a=2&a=3&a=4 在此记录一下 axios是自带qs因此无需再下载,可直接操作qs.stringify(params, { indices: false }), import qs from 'qs ... //引用时将params:{a:[1,2,3,4]}传入 temp(params){

  • 《机器学习Python实现_10_08_集成学习_bagging_randomforest实现》2021-05-06 21:04:17

    一.简介 为了让学习器越发的不同,randomforest的思路是在bagging的基础上再做一次特征的随机抽样,大致流程如下: 二.RandomForest:分类实现 import os os.chdir('../') from ml_models import utils from ml_models.tree import CARTClassifier import copy import numpy as np """

  • 定时删除10天前的Es索引2021-04-28 23:56:55

    阅读目录说明删除索引shell添加定时任务说明  主要用在索引名为 xxxx-yyyy.MM.dd 这种,可以自定义修改下边的脚本删除索引shell 创建 delete_es_indices_over_10_day.sh#!/bin/bash ################################### #删除早于十天的ES集群的索引 ########################

  • python之独热编码的实现2021-04-24 14:52:45

    numpy实现tensorflow实现        独热编码即 One-Hot 编码,又称一位有效编码,其方法是使用N位状态寄存器来对N个状态进行编码,每个状态都有它独立的寄存器位,并且在任意时候,其中只有一位有效。        上图表示的是独热编码(“one hot” encoding)的转换过程,在转换后的表

  • java elasticsearch index2021-04-16 22:02:30

    es版本6.8.*及以下,7.9.*不适用。 直接贴代码 import java.io.FileNotFoundException; import java.io.IOException; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.Execut

  • CF1009F Dominant Indices2021-04-09 14:32:09

    I.III.CF1009F Dominant Indices 大约一年前,我曾用线段树合并硬刚过了这题,现在是正解。 可以设 \(f_{i,j}\) 表示 \(i\) 子树中深度为 \(j\) 的点的数量。于是直接长剖优化即可。时间复杂度 \(O(n)\)。 虽然因为我极其垃圾的实现导致还没有线段树合并跑得快 代码: #include<bits/st

  • 力扣 LeetCode - 1528. 重新排列字符串2021-03-09 15:29:38

    1528. 重新排列字符串 题目: 给你一个字符串 s 和一个 长度相同 的整数数组 indices 。 请你重新排列字符串 s ,其中第 i 个字符需要移动到 indices[i] 指示的位置。 返回重新排列后的字符串。 示例 1: 输入:s = "codeleet", indices = [4,5,6,7,0,2,1,3] 输出:"leetcode" 解释:如图

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有