【问题标题】:ILNumerics plot 2d chartILNumerics 绘制 2d 图表
【发布时间】:2014-03-24 23:43:28
【问题描述】:

您好,我在 ILArray 中保存了 2d 矩阵数据。该矩阵表示来自一个神经元的神经网络的权重,我想看看权重在非数字中的样子。知道我该怎么做吗?我找到了很多 3d 绘图的例子,但没有找到 2d 图像数据表示的例子。

【问题讨论】:

    标签: c# .net plot 2d ilnumerics


    【解决方案1】:

    图像数据目前最好(最简单)通过使用 ILSurface 进行可视化。由于这是 3D 图,因此您可能无法获得大型图像数据的最佳性能。幸运的是,ILNumerics 的场景图可以通过您自己的实现轻松改进这一点。

    最简单的尝试是采用 ILPoints 形状,在网格中排列所需数量的点,并让每个点可视化输入矩阵中相应元素的值 - 比如说颜色(或大小)。

    private void ilPanel1_Load(object sender, EventArgs e) {
        using (ILScope.Enter()) {
            // some 'input matrix'
            ILArray<float> Z = ILSpecialData.sincf(40, 50);
            // do some reordering: prepare vertices
            ILArray<float> Y = 1, X = ILMath.meshgrid(
                                ILMath.vec<float>(1, Z.S[1]), 
                                ILMath.vec<float>(1,Z.S[0]),
                                Y); 
            // reallocate the vertex positions matrix
            ILArray<float> pos = ILMath.zeros<float>(3, X.S.NumberOfElements); 
            // fill in values
            pos["0;:"] = X[":"]; 
            pos["1;:"] = Y[":"]; 
            pos["2;:"] = Z[":"]; 
    
            // colormap used to map the values to colors
            ILColormap cmap = new ILColormap(Colormaps.Hot);
            // setup the scene
            ilPanel1.Scene.Add(new ILPlotCube {
                new ILPoints() {
                    Positions = pos, 
                    Colors = cmap.Map(Z).T, 
                    Color = null
                }
            }); 
        }
    }
    

    显然,生成的点不会随表格缩放。因此,当表格尺寸增加时,“图像”的点之间的间隙会更大。因此,为了更好地实现,您可以调整使用ILTriangles 而不是ILPoints 的方法,以便组装相邻的矩形。

    【讨论】:

    • 谢谢。这听起来不错。顺便提一句。您是否打算从 matlab 向 ilnumerics 添加一些功能,例如 imagesc?我正在尝试 ilnumerics 和它的伟大。保持好工作! :)
    • 谢谢。 ImageSC 绘图将包含在 2014 年 7 月发布的 ILNumerics Ultimate VS 中。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-09-20
    • 1970-01-01
    • 2013-11-06
    • 1970-01-01
    • 2016-11-14
    • 2015-03-25
    • 1970-01-01
    相关资源
    最近更新 更多