小编use*_*636的帖子

连接在127.0.1.1 java RMI被拒绝

我是Java RMI技术的新手.我有一个问题,已经有其他程序员,但我无法理解他们在教程中做了什么,以解决它.我用Java RMI实现了游戏"tic tac toe".这里是ControllerServer代码

public ControllerServer() {

    try {
        game = new GameImpl();
        BoardView view = new BoardView(this);
        viewUpdater = new ServerViewUpdaterImpl(view);

        Game gameStub = (Game) UnicastRemoteObject.exportObject(game, 1099);
        ServerViewUpdater serverViewStub = (ServerViewUpdater) UnicastRemoteObject.exportObject(viewUpdater, 1099);

        Registry registry = LocateRegistry.createRegistry(1099);

        registry.rebind("TTTGame", gameStub);
        registry.rebind("TTTServerView", serverViewStub);


    } catch (Exception e) {
        e.printStackTrace();
    }
}
Run Code Online (Sandbox Code Playgroud)

这里是ControllerClient

public ControllerClient() {
    try {

        BoardView view = new BoardView(this);
        localView = new ClientViewUpdaterImpl(view);

        String address = JOptionPane.showInputDialog("Insert server's address: ");

        Registry registry = LocateRegistry.getRegistry(address, 1099);

        game = …
Run Code Online (Sandbox Code Playgroud)

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

在 keras 中训练时,当 a 的形状和权重不同时,必须指定轴

我正在尝试训练一个网络,其中使用两个生成器,一个用于训练,一个用于验证。这些只是毫无道理地产生样本的函数。

我在验证最后收到以下错误:

File "/home/ubuntu/tensorflow/lib/python3.5/site-packages/numpy/lib/function_base.py", 
line 1142, in average "Axis must be specified when shapes of a and weights "
Run Code Online (Sandbox Code Playgroud)

我查看了代码,training_generator其中的函数keras.engine包含以下行

averages.append(np.average([out[i] for out in outs_per_batch], weights=batch_sizes))
Run Code Online (Sandbox Code Playgroud)

查看 的定义np.average,该函数要求axis权重和数组的长度不同。我调试了代码,并通过放置axis=0np.squeeze覆盖out[i]它“”“”工作“”“”,只是在收集验证的摘要统计信息后停止几行。我无法停止认为我的代码中其他地方有错误。

这是我的发电机

def batch_generator(batch_size, folder):
    files = listdir(folder)
    print("Folder " + folder + " with " + str(len(files)) + " files.")
    np.random.shuffle(files)
    while True:
        np.random.shuffle(files)
        for i in range(batch_size, len(files), batch_size):
            batch = files[(i-batch_size):(i)]
            batch = tensor_generator(folder, files=batch)
            yield …
Run Code Online (Sandbox Code Playgroud)

python deep-learning keras tensorflow

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

使用眼动仪数据创建带有R的热图

我有一个由以下数据组成的表

frame,X,Y
Run Code Online (Sandbox Code Playgroud)

这是来自多个眼动追踪分析的结果数据.现在我想用R创建一个Heatmap,如下所示 在此输入图像描述

我尝试了几个在线发现的脚本,没有一个给我这个结果.

我能怎么做?


这里有一些示例数据忽略前两列

task,visualization,frame,X,Y
1,b,1,383,221
1,b,1,632,356
1,b,1,947,663
1,b,1,546,206
1,b,1,488,272    
1,b,1,578,752
1,b,1,415,261
1,b,1,693,158
1,b,1,684,528
1,b,1,592,67
1,b,1,393,180
1,b,1,1033,709
1,b,1,1080,739
1,b,1,711,523
1,b,1,1246,49
1,b,1,742,69
1,b,1,601,370
1,b,10,902,684
1,b,10,517,241
1,b,10,583,86
1,b,10,582,754
1,b,10,426,257
1,b,10,575,229
1,b,10,697,150
1,b,10,379,520
1,b,10,390,286
1,b,10,618,396
1,b,10,710,143
1,b,10,383,188
1,b,10,1026,713
1,b,10,1078,625
1,b,10,713,521
Run Code Online (Sandbox Code Playgroud)

csv r heatmap ggplot2

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

对类::方法C++的未定义引用

编译后面的源代码时出现问题:

    QString code = this->viewManager()->activeView()->document()->text();
    Qualifier qua;
    qua.setQCode(code);
Run Code Online (Sandbox Code Playgroud)

它告诉我

error: undefined reference to `Qualifier::setQCode(QString)'
Run Code Online (Sandbox Code Playgroud)

qualifier.h和.cpp的代码如下

#ifndef __QUALIFIER_H__
#define __QUALIFIER_H__

#include <iostream>
#include <string>
#include <QString>
#include <queue>
#include "analyser.h"



using namespace std;



class Qualifier
{

private:

    string code;
    queue<method> tokenisedCode;
    //queue<analysis> analysedCode;

void tokeniseCode();

public :


void setCode(string code);

void setQCode(QString code);

void computeLocAnalysis();

void computeCCAnalysis();

void visualiseResults();


};

 #endif /* __QUALIFIER_H__ */
Run Code Online (Sandbox Code Playgroud)

而且CPP是

#include "qualifier.h"

using namespace std;


void Qualifier::tokeniseCode()
{

Parser par;
par.setCode(code);
par.parse();
this->tokenisedCode = par.getMethods();

} …
Run Code Online (Sandbox Code Playgroud)

c++ reference

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

标签 统计

c++ ×1

csv ×1

deep-learning ×1

ggplot2 ×1

heatmap ×1

keras ×1

python ×1

r ×1

reference ×1

tensorflow ×1