小编rol*_*asi的帖子

如何在电报机器人上发送照片

我只是实现了一个简单的机器人,该机器人应该将一些照片和视频发送给我chat_id。好吧,我正在使用python,这是脚本

import sys
import time
import random
import datetime
import telepot

def handle(msg):
    chat_id = msg['chat']['id']
    command = msg['text']

    print 'Got command: %s' % command

    if command == 'command1':
        bot.sendMessage(chat_id, *******)
    elif command == 'command2':
        bot.sendMessage(chat_id, ******)
    elif command == 'photo':
        bot.sendPhoto(...)

bot = telepot.Bot('*** INSERT TOKEN ***')
bot.message_loop(handle)
print 'I am listening ...'

while 1:
    time.sleep(10)
Run Code Online (Sandbox Code Playgroud)

在这一行中,bot.sendphoto我将插入chat_id图像的路径和,但是什么也没有发生。

我哪里错了?

谢谢

python telegram-bot telepot

7
推荐指数
6
解决办法
1万
查看次数

主成分分析,有多少个成分?

我不明白 PCA 的一点。PCA 返回使每个特征的方差最大化的方向?我的意思是,它将为我们原始空间的每个特征返回一个组件,并且只有k最大的组件将用作新子空间的轴,对吗?所以实际上,如果我在 50-D 中并且 49 个特征具有很强的方差,我可以传递到 49-D 空间吗?当然,我说的是简单的英语,没有正式或技术性的内容。

谢谢

machine-learning pca

4
推荐指数
1
解决办法
2477
查看次数

shuffle阶段和combiner阶段有什么区别?

我对 MapReduce 框架很困惑。我从不同的来源读到了这方面的内容,感到很困惑。顺便说一句,这是我对 MapReduce 作业的想法

1. Map()-->emit <key,value>  
2. Partitioner (OPTIONAL) --> divide
    intermediate output from mapper and assign them to different
    reducers
3. Shuffle phase used to make: <key,listofvalues>    
4. Combiner,    component used like a minireducer wich perform some
    operations on    datas and then pass those data to the reducer.
    Combiner is on local    not HDFS, saving space and time.    
5. Reducer, get the data from the    combiner, perform further
    operation(probably the same as the    combiner) then release the …
Run Code Online (Sandbox Code Playgroud)

hadoop mapreduce partitioner combiners

2
推荐指数
1
解决办法
4291
查看次数