小编anu*_*anu的帖子

layered_perceptron:ConvergenceWarning:随机优化器:达到最大迭代次数并且优化尚未收敛.警告?

我写了一个基本程序来了解MLP分类器中发生了什么?

from sklearn.neural_network import MLPClassifier
Run Code Online (Sandbox Code Playgroud)

数据:标记为男性或女性的身体指标(身高,宽度和鞋码)的数据集:

X = [[181, 80, 44], [177, 70, 43], [160, 60, 38], [154, 54, 37], [166, 65, 40],
     [190, 90, 47], [175, 64, 39],
     [177, 70, 40], [159, 55, 37], [171, 75, 42], [181, 85, 43]]
y = ['male', 'male', 'female', 'female', 'male', 'male', 'female', 'female',
     'female', 'male', 'male']
Run Code Online (Sandbox Code Playgroud)

准备模型:

 clf= MLPClassifier(hidden_layer_sizes=(3,), activation='logistic',
                       solver='adam', alpha=0.0001,learning_rate='constant', 
                      learning_rate_init=0.001)
Run Code Online (Sandbox Code Playgroud)

培养

clf= clf.fit(X, y)
Run Code Online (Sandbox Code Playgroud)

学习分类器的属性:

print('current loss computed with the loss function: ',clf.loss_)
print('coefs: ', clf.coefs_)
print('intercepts: ',clf.intercepts_)
print(' …
Run Code Online (Sandbox Code Playgroud)

machine-learning neural-network scikit-learn

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

是否可以使用任何 IDE(例如 PYCHARM)在 AWS 实例中进行 SSH 连接?

我遇到了一个项目的技术问题,我认为论坛可以帮助我。

我有一个Instance Type:p2.xlarge在 AWS 上运行的 EC2 ,我在这个实例中克隆了一个存储库,它需要 pytorch 和 cuda 依赖项(这一点已经解决)。

现在,问题是我想在我本地的 pyCHARM IDE 中以某种方式工作和运行这个代码库(现在是 AWS 实例)。简而言之,我的笔记本电脑上没有合适的资源来运行存储库,因此我必须在 AWS 实例中运行,但出于调试目的,本地 IDE 将是一个不错的选择。

有没有可能做到这一点?换句话说,我们可以通过 SSH 进入 AWS 实例并运行代码,但一切都将通过命令行完成,如果我们可以通过 PYCHARM 进行 SSH 并且可以在 PYCHARM 的本地机器上看到 AWS 中的代码并更改、调试或运行它因为它是本地的,但实际上它是在实例中执行的。

请提出解决方案。提前致谢。

编辑-1:

在遵循@Cromulent 建议之后,我来到这里 设置遥控器:

在此处输入图片说明

上传发生在本地和远程仓库中。 在此处输入图片说明

当我只想在 PYCHARM IDE 中打开远程文件夹并对其进行处理时,我仍然不明白同步本地和远程文件夹的要求。

我认为在此设置后,我必须更改本地副本中的代码,PYCHARM 将同步远程副本中的代码。我将如何运行(使用远程实例的资源 GPU,而不是我的本地机器。)在这种情况下 PYCHARM 中的远程代码,我只是同步它,再次运行我必须通过命令行 ssh 并运行脚本(这不符合目的)?

EDIT-2: 在@Cromulent 建议之后。

实际上,它确实有效,但仍然无法在本地运行远程代码。运行任何远程脚本时出现以下错误。如果我在终端中使用 ssh 运行相同的脚本,脚本会正常运行。我试图使用StackOverflow 上的这篇文章来解决这个问题,但它也没有奏效。

ssh://ubuntu@ec2-52-41-247-169.us-west-2.compute.amazonaws.com:22/home/ubuntu/anaconda3/bin/python -u <08ad9807-3477-4916-96ce-ba6155e3ff4c>/home/ubuntu/InsightProject/scripts/download_flownet2.py
/home/ubuntu/anaconda3/bin/python: can't open file '<08ad9807-3477-4916-96ce-ba6155e3ff4c>/home/ubuntu/InsightProject/scripts/download_flownet2.py': [Errno 2] No such file or directory
Run Code Online (Sandbox Code Playgroud)

下面是上述问题的截图: 在此处输入图片说明

ssh sftp amazon-ec2 amazon-web-services pycharm

5
推荐指数
1
解决办法
2220
查看次数

如何在 TensorFlow 中从头开始训练 Deeplab 模型?

我正在使用deepLab为城市景观数据集中的视频生成语义分割屏蔽图像。所以,我从预训练模型xception65_cityscapes_trainfine 开始提供并在数据集上对其进行了进一步训练。

我很想知道如何从头开始训练它?而不是最终只使用预先训练的模型?任何人都可以就我如何实现它提出一个方向吗?

来自社区的任何贡献都会有所帮助和赞赏。

tensorflow

5
推荐指数
0
解决办法
771
查看次数

Tf.Print()不打印张量的形状吗?

我使用Tensorflow编写了一个简单的分类程序,并获得了输出,除了我尝试打印用于模型参数,特征和偏差的张量的形状。功能定义:

import tensorflow as tf, numpy as np
from tensorflow.examples.tutorials.mnist import input_data


def get_weights(n_features, n_labels):
#    Return weights
    return tf.Variable( tf.truncated_normal((n_features, n_labels)) )

def get_biases(n_labels):
    # Return biases
    return tf.Variable( tf.zeros(n_labels))

def linear(input, w, b):
    #  Linear Function (xW + b)
#     return np.dot(input,w) + b 
    return tf.add(tf.matmul(input,w), b)

def mnist_features_labels(n_labels):
    """Gets the first <n> labels from the MNIST dataset
    """
    mnist_features = []
    mnist_labels = []
    mnist = input_data.read_data_sets('dataset/mnist', one_hot=True)

    # In order to make quizzes run faster, we're …
Run Code Online (Sandbox Code Playgroud)

classification machine-learning deep-learning python-3.5 tensorflow

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

如何在聚合管道mongodb中使用$update/$set运算符?

我正在尝试根据某些条件更新name我的集合中调用的字段。coll1我首先创建了一个聚合管道,根据我的标准过滤出文档。

var local_filter = { "$or" :[ 
                                          {'fullText': {'$eq': "404 Error"}},
                                          {'fullText': {'$eq': "Unknown Error"}},
                                          {'fullText': {'$eq': "503 Error"}},
                                          {'fullText': {'$eq': "400 Error"}},
                                          {'fullText': {'$eq': "500 Error"}},
                                          {'fullText': {'$eq': "Read timed out"}},
                                          {'fullText': {'$eq': "410 Error"}},
                                          {'fullText': {'$eq': "403 Error"}},
                                          {"fullText": {'$eq':""}},
                              ]}

var foreign_filter= { "$and" :[
                              {'matchingrecords.Text': {'$ne': "404 Error"}},
                              {'matchingrecords.Text': {'$ne': "Unknown Error"}},
                              {'matchingrecords.Text': {'$ne': "503 Error"}},
                              {'matchingrecords.Text': {'$ne': "400 Error"}},
                              {'matchingrecords.Text': {'$ne': "500 Error"}},
                              {'matchingrecords.Text': {'$ne': "Read timed out"}},
                              {'matchingrecords.Text': {'$ne': "410 …
Run Code Online (Sandbox Code Playgroud)

mongodb mongodb-query nosql-aggregation aggregation-framework

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

如何使用react-google-maps库创建折线

我试图使用react-google-maps库在4个GPS坐标之间绘制Polyline.地图上没有任何内容呈现

import React from 'react';
import { withGoogleMap, GoogleMap, Marker, InfoWindow,Polyline } from 'react-google-maps';


class googleMapComponent extends React.Component {
Run Code Online (Sandbox Code Playgroud)

//高阶组件​​:withGoogleMap用作函数调用.这个功能返回另一个组件定义,后来安装在渲染中

 // maintain a refernce to a map inside the component, so that
    constructor(){
        super()
        this.state ={
            map:null
        }
    }

    mapMoved(){
        console.log('mapMoved: ' + JSON.stringify(this.state.map.getCenter()))
    }

    mapLoaded(map){
        //console.log('mapLoaded: ' + JSON.stringify(map.getCenter()))
        if(this.state.map !==null)
            return

        this.setState({
            map:map
        })
    }

    zoomchanged(){
        console.log('mapZoomed: ' + JSON.stringify(this.state.map.getZoom()))
    }
    handleMarkerClick(targetMarker) {
        this.setState({
            markers: this.state.markers.map(marker => {
                if (marker === targetMarker) {
                    return {
                        ...marker,
                        showInfo: true, …
Run Code Online (Sandbox Code Playgroud)

google-maps google-maps-api-3 reactjs

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

如何修复“std::logic_error” what(): basic_string::_M_construct null not valid 错误?

我正在尝试检查输入字符串是字母数字还是大写或空。如果输入字符串在上述出现故障的字符串中,我只想返回 false/0 否则与工作正常的程序的其余部分一起工作。我的程序块有问题:

std::string myfunc(std::string input){
    std::string b="";

    if (!input.size()) return 0;
    for (int i = 0; i < input.size(); i++){

        if ( input[i] < 'a' || input[i] > 'z'|| isalpha(input[i]) || isupper(input[i]) ) return 0;
    }
    b = input;
    //just copy the input string for now.
    return b;
}
Run Code Online (Sandbox Code Playgroud)

我把这个函数称为

int main(){
    std::string input="Somthing";
    std::cout << myfunc(input)<< std::endl;
    return  0;
}
Run Code Online (Sandbox Code Playgroud)

收到以下错误?

terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_M_construct null not valid
Aborted (core dumped)
Run Code Online (Sandbox Code Playgroud)

该程序在没有这两个边缘情况的情况下运行良好。我无法理解错误并找到解决方法?关于我做错了什么的任何建议?

c++

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