vue中使用visjs小记

vue+vis 图中的节点和线都是可以拖动的哦,在graphViz.vue的代码里面,有很多参数可以改动,可以自己改动试试看。(1)为vis创建一个单独的.vue文件,vue文件名命名必须是驼峰命名法,要不然会报错。1.搭建好vue后,可以使用npm run vis-network 下载 vis插件。(2)graphViz.vue文件具体代码如下,我的节点比较多,可以自己删一下。2.下载好之后,可以在package.json中看见依赖更新。上图就是展示的结果,在想要的位置进行展示。以上就是单独创建vis组建的代码。 阅读详情

vue中的template部分:

<div style="border-right:1px dashed #eee;">
        <!--节点编辑框-->
         <div id="node-popUp"> 
           <p id="node-operation">node</p> <br>
           <div style="margin: 10px;display:flex;align-items:center;">
             <div style="flex:0 0 30%;margin-right:10px;text-align:right;">ID</div>
             <input disabled id="node-id" value="new value" class="ivu-input ivu-input-disabled" style="margin-right:20px;"/>
          </div>
          <div style="margin: 10px;display:flex;align-items:center;">
             <div style="flex:0 0 30%;margin-right:10px;text-align:right;">节点名称</div>
             <input id="node-label" value="new value" class="ivu-input" style="margin-right:20px;" />
          </div>
          <div style="margin: 10px;display:flex;align-items:center;">
             <div style="flex:0 0 30%;margin-right:10px;text-align:right;">节点类型</div>
             <select id="node-type" class="ivu-select-selection ivu-input" style="margin-right:20px;">
                <option v-for="item in nodeType"  :value="item.type" class="ivu-select-item">{{item.label}}</option>
             </select>
          </div>
          <div style="margin: 30px 20px;">
             <input type="button" value="确定" id="node-saveButton" class="ivu-btn ivu-btn-primary" style="margin: 0 20px;" />
             <input type="button" value="取消" id="node-cancelButton" class="ivu-btn ivu-btn-primary" style="margin: 0 10px;"/>
          </div>
        </div>

      <!--连线编辑框-->
        <div id="edge-popUp">
          <p id="edge-operation">edge</p>
          <div style="margin: 10px;display:flex;align-items:center;">
            <div style="flex:0 0 30%;margin-right:10px;text-align:right;">关系名称</div>
            <input id="edge-label" value="new value" class="ivu-input" style="margin-right:20px;" />
          </div>
          <div style="margin: 10px;display:flex;align-items:center;">
            <div style="flex:0 0 30%;margin-right:10px;text-align:right;">关系类型</div>
            <select id="edge-type" class="ivu-select-selection ivu-input" style="margin-right:20px;">
              <option v-for="item in edgeType"  :value="item.color" class="ivu-select-item">{{item.label}}</option>
            </select>
          </div>
          <div style="margin: 30px 20px;">
            <input type="button" value="确定" id="edge-saveButton" class="ivu-btn ivu-btn-primary" style="margin: 0 20px;" />
            <input type="button" value="取消" id="edge-cancelButton" class="ivu-btn ivu-btn-primary" style="margin: 0 10px;"/>
          </div>
        </div>
        <div id="mynetwork">
        	<!--用于画关系图的部分-->
        </div>
      </div>

vue 中的 javascript 部分:

	export default {
	    data() {
	        return {
	          nodeType: [{//节点类型下拉选项
	            label: '蔬菜',
	            type: 'vegtables'
	          },{
	            label: '水果',
	            type: 'fruit''
	          }],
	          edgeType: [{
	            label: '资金',
	            color: '#0066CC'
	          },{
	            label: '关系',
	            color: '#9933cc'
	          },{
	            label: '物品',
	            color: '#663300'
	          }]
	        };
	    },
		mounted () {  //
		    this.draw();
		},
		methods: {
			draw () {
	          let _this = this;
	          this.nodes = new DataSet(this.nodesList);

	          // create an array with edges
	          this.edges = new DataSet(this.edgesList);
	
	          // create a network
	          var container = document.getElementById('mynetwork');
	          var data = {
	            nodes: this.nodes,
	            edges: this.edges
	          };
	          var options = {
	            autoResize: false,
	            interaction: {
	              hover: true
	            },
	            locale: 'cn',//工具栏显示中文
	            locales: {
	              cn: {//工具栏中文翻译
	                edit: '编辑',
	                del: '删除当前节点或关系',
	                back: '返回',
	                addNode: '添加节点',
	                addEdge: '添加连线',
	                editNode: '编辑节点',
	                editEdge: '编辑连线',
	                addDescription: '点击空白处可添加节点',
	                edgeDescription: '点击某个节点拖拽连线可连接另一个节点',
	                editEdgeDescription: '可拖拽连线改变关系',
	                createEdgeError: 'Cannot link edges to a cluster.',
	                deleteClusterError: 'Clusters cannot be deleted.',
	                editClusterError: 'Clusters cannot be edited.'
	              }
	          },
	          manipulation: {//工具栏
	              enabled: true,
	              initiallyActive: true, //直接显示工具栏
	              addNode: function(data, callback) {  //添加节点
	                // filling in the popup DOM elements
	                document.getElementById('node-operation').innerHTML = "新增节点";
	                document.getElementById('node-id').value = data.id;
	                data.group = 'fruit';
	                editNode(data, clearNodePopUp, callback);
	              },
	              editNode: function(data, callback) {  //编辑节点
	                // filling in the popup DOM elements
	                document.getElementById('node-operation').innerHTML = "编辑节点";
	                document.getElementById('node-id').value = data.id;
	                editNode(data, cancelNodeEdit, callback);
	              },
	              addEdge: function(data, callback) {
	                document.getElementById('edge-operation').innerHTML = "新增连线";
	                document.getElementById('edge-type').value = '#9933cc';
	                editEdgeWithoutDrag(data, callback);
	              },
	              editEdge:function(data, callback) {
	                  document.getElementById('edge-popUp').style.display = 'block';
	                  document.getElementById('edge-operation').innerHTML = "编辑连线";
	                  editEdgeWithoutDrag(data, callback);
	                }
	          },
	          nodes: { //节点配置
	              borderWidth: 0, //节点边框的宽度,单位为px
	              color: { //字体配置
	                border: '#fff',
	                background: '#fff'
	              },
	              font: { //字体配置
	                color: '#333'
	              },
	              widthConstraint: { //节点名称宽度
	                maximum: 80
	              }
	            },
	            edges: { //连线配置
	              color: {
	                color: '#9933cc',
	                highlight: '#9933cc',
	                hover: '#9933cc'
	              },
	              widthConstraint: { //连接线信息宽度
	                maximum: 50
	              },
	              smooth: true, //是否显示方向箭头
	              arrows: { //箭头指向from节点
	                to: true
	              }
	            },
	            physics: {   
	              maxVelocity: 4,
	              minVelocity: 0.62,
	            },
	            groups: {   
	              vegetables: {
	                shape: 'image',
	                image: file,
	              },
	              fruit: {
	                shape: 'circularImage',
	                image: witness,
	              }
	            }
	          };
	          window.network = new Network(container, data, options);
	
	          network.on("dragEnd", e => {  //拖拽完成
	            var _nodeId = e.nodes[0];
	            if (typeof _nodeId === 'undefined')
	              return;
	            _this.nodes.update({
	              id: _nodeId,
	              fixed: {
	                x: true,
	                y: true
	              }
	            });
	          });
	
	
	          network.on('dragStart', e => { //拖拽开始前
	            var _nodeId = e.nodes[0];
	            if (typeof _nodeId === 'undefined')
	              return;
	            _this.nodes.update({
	              id: _nodeId,
	              fixed: {
	                x: false,
	                y: false
	              }
	            });
	          });
	
	          network.on("click", params => {  //点击画布
	    
	          });
	
	          network.on("selectEdge", function (params) { //选择edge
	               console.log('selectEdge Event:', params);
	          });
	
	
	          network.on("hoverNode", params => {  //hover节点时
	            document.getElementById("mynetwork").getElementsByTagName("canvas")[0].style.cursor = "pointer";
	          });
	
	        },
	    }
	 };
	
	function editNode(data, cancelAction, callback) {
	        document.getElementById('node-label').value = data.label;
	        document.getElementById('node-type').value = data.group;
	        document.getElementById('node-saveButton').onclick = saveNodeData.bind(this, data, callback);
	        document.getElementById('node-cancelButton').onclick = cancelAction.bind(this, callback);
	        document.getElementById('node-popUp').style.display = 'block';
	      }
	
	
	 // Callback passed as parameter is ignored
	function clearNodePopUp() {
	        document.getElementById('node-saveButton').onclick = null;
	        document.getElementById('node-cancelButton').onclick = null;
	        document.getElementById('node-popUp').style.display = 'none';
	}
	
	
	function cancelNodeEdit(callback) {
	        clearNodePopUp();
	        callback(null);
	}
	
	
	function saveNodeData(data, callback) {
	        data.label = document.getElementById('node-label').value;
	        data.group = document.getElementById('node-type').value;
	        clearNodePopUp();
	        callback(data);
	}
	
	
	function editEdgeWithoutDrag(data, callback) {
	        // filling in the popup DOM elements
	        document.getElementById('edge-label').value = data.label;
	        document.getElementById('edge-saveButton').onclick = saveEdgeData.bind(this, data, callback);
	        document.getElementById('edge-cancelButton').onclick = cancelEdgeEdit.bind(this, callback);
	        document.getElementById('edge-popUp').style.display = 'block';
	}
	
	
	function clearEdgePopUp() {
	        document.getElementById('edge-saveButton').onclick = null;
	        document.getElementById('edge-cancelButton').onclick = null;
	        document.getElementById('edge-popUp').style.display = 'none';
	}
	
	
    function cancelEdgeEdit(callback) {
	        clearEdgePopUp();
	        callback(null);
	}
	
	
	function saveEdgeData(data, callback) {
	        if (typeof data.to === 'object')
	          data.to = data.to.id
	        if (typeof data.from === 'object')
	          data.from = data.from.id
	        data.label = document.getElementById('edge-label').value;
	        data.color = document.getElementById('edge-type').value;
	        clearEdgePopUp();
	        callback(data);
	}

vue中的style部分:

#mynetwork{
  width: 100%;
  height: 735px;
  margin: 0;
  border: 2px solid #fff;
  color: #3693ff;
  font: 14pt arial;
  position:relative;


  & .vis-manipulation{
    display:flex !important;
    position: absolute;
    left: 65%;
    top: 30px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ccc;


    & .vis-label {
      margin: 0 0 0 23px;
      line-height: 25px;
    }


    & .vis-separator-line {
      float: left;
      display: inline-block;
      width: 1px;
      height: 21px;
      background-color: #bdbdbd;
      margin: 0 7px 0 15px;
    }


    & .vis-button{
      font-family: verdana;
      font-size: 1rem;
      background-position: 0 0;
      background-repeat: no-repeat;
      height: 24px;
      margin-left: 10px;
      cursor: pointer;
      padding: 0 8px 0 8px;
      display:inline-flex;
      background-size: contain;
    }


    & .vis-add{
      background-image: url(./img/添加节点.svg);
    }
    & .vis-connect{
      background-image: url(./img/添加连线.svg);
    }
    & .vis-edit{
      background-image: url(./img/编辑.svg);
    }
    & .vis-delete{
      background-image: url(./img/删除.svg);
    }
    & .vis-back{
      background-image: url(./img/返回.svg);
    }
  }


  & .vis-edit-mode{
    position: absolute;
    left:63%;
    top: 15px;
    height: 20px;
    & .vis-edit{
      background-image: url(./img/编辑.svg);
      background-size: contain;
      background-repeat: no-repeat;
      width: 80px;
      position: relative;
      & .vis-label {
        font-size:1rem;
        cursor:pointer;
        position: absolute;
        bottom:0;
        left: 25px;
      }
    }


  }
  & .vis-close{
    position: absolute;
    cursor: pointer;
    right:10px;
    top: 5px;
    height: 20px;
    width: 20px;
    background-image: url(./img/cross.svg);
    background-size: contain;
    background-position: 0 0;
    background-repeat: no-repeat;
  }
}


#operation {
  font-size:28px;
}
#node-popUp {
  display:none;
  position: absolute;
  top: 90px;
  right: 10px;
  z-index: 299;
  width: 400px;
  height: 300px;
  text-align: center;
  border: 1px solid #eee;
  box-shadow: 0px -5px 5px rgba(0, 0, 0, 0.14);
}
#edge-popUp {
  display:none;
  position: absolute;
  top: 90px;
  right: 10px;
  z-index: 299;
  width: 400px;
  height: 250px;
  text-align: center;
  border: 1px solid #eee;
  box-shadow: 0px -5px 5px rgba(0, 0, 0, 0.14);
}
#node-operation, #edge-operation{
  padding:10px;
  border-bottom: 1px solid #eee;
}
vue---vis实现复杂网状关系图显示 vis.js是基于浏览器的动态可视化库。能够处理大量的动态数据,实现对数据的操作和交互。 首先,贴上一个很好的vis.js参考文档:https://yajunfan.github.io/vis/#/module 案例效果如图 (1)安装【npm inatall vis --save】 (2)引入:在【main.js】中引入【import"vis/dist/vis.css";】,在展示网状图的页面引入【importVisfrom"vis";】 (3)实现 网状图实现: 首先在html.... 阅读详情

相关推荐

Vue使用vis实现拓扑图

visjs官方文档visjs示例 1. 安装 npm install vis 2. 封装成组件 <template> <div :id="id" style="width: 100%; height: 100%"></div> </template> <script> import vis from "vis"; let options; export default { data() { return { .

专注于技术,分享实战经验,探索技术边界,用代码构建更美的数字世界。 8269

visjs入门--模块manipulation

manipulation // these are all options in full. var options = { manipulation: { enabled: false, initiallyActive: false, addNode: true, addEdge: true, editNode: undefined, edi...

尊哥的博客 1862

vue 集成 vis-network 实现网络拓扑图的方法

vis.js  网站 https://visjs.org/ vs  code 下安装命令 npm install vis-network 在vue  下引入 vis-network组件 const vis = require("vis-network/dist/vis-network.min.js"); require("vis-network/dist/vis-network.min.css"); 例子代码使用 let DIR = "/jtopo/"; let nodes = [ { id: 1, shape: "circularImage", image: DIR + "server

手把手教你使用vue创建第一个vis.js

手把手教你使用vue搭建第一个vis.js项目,npm install vis安装以及import导入vis

笑到世界都狼狈的博客 3304

AES攻击方法 :差分密码分析 boomerang attack飞去来器攻击

AES具有123比特的分组长度,三种可选的密钥长度(128,192,256) AES是一个迭代型密码,轮数依赖于密钥长度。如果密钥长度为128比特,则轮数为10;如果密钥长度为192比特,则轮数为12;如果密钥长度为256比特,则轮数为14; 混淆(Confusion) 混淆是为了让密钥与密文的统计信息之间的关系变得复杂,从而增加通过统计方法进行攻击的难度。混淆可以通过各种代换算法实现,如S盒、乘法(加)与异或等运算组合,为非线性部件。 扩散(Diffusion) 扩散是为了让明文的单个比特影像到

m0_67105022的博客 3492

ArcGIS栅格拼接全攻略:从核心原理到色彩平衡与大数据处理

在GIS数据处理中,栅格拼接是一项基础且关键的操作,其本质是将多幅具有重叠区域的栅格图像无缝整合为一张完整地图。该技术涉及空间参考统一、像元对齐与色彩融合等核心原理,是构建连续地理空间数据的基石。其技术价值在于保障数据完整性、提升可视化效果,并为后续的空间分析提供可靠底图。在遥感影像处理、数字高程模型构建及地图制图等应用场景中,高质量的拼接成果至关重要。本文聚焦于ArcGIS平台,深入解析其栅格拼接工具,并针对常见的色彩不一致与大数据量处理难题,提供了基于**色彩平衡**和**金字塔**优化的实战解决方案,

weixin_33158887的博客 263

【visjs】使用visjs绘制关系图

附上链接: vis网站 visjs中文使用说明文档 使用步骤: 1、安装 npm install vis-network 2、在页面中引入 <div id="mynetwork" class="myChart" :style="{width: '100%', height: '90vh'}"></div> require('vis-network/dist/dist/vis-network.min.css') const vis = require('vis-network/di

LuviaWu的博客 3318

CH592F RISC-V蓝牙LED灯设计:WS2812B驱动与微信小程序控制

蓝牙低功耗(BLE)是嵌入式物联网设备主流无线通信技术,其核心在于协议栈轻量化、射频稳定性与外设协同调度。基于RISC-V内核的蓝牙SoC(如CH592F)凭借高集成度、低待机电流和免外部巴伦的射频设计,显著降低硬件复杂度与BOM成本;而WS2812B作为单线级联RGB LED,依赖微秒级精准时序,需借助定时器+DMA机制规避CPU干预,保障动态效果流畅性。该方案融合电容触摸交互、GATT服务自定义与微信小程序标准Bluetooth API对接,适用于智能照明、DIY彩灯及教学实践等场景,是BLE+LED实

weixin_31163455的博客 434

整理使用visjs生成关系拓扑图

Html引入: https://unpkg.com/browse/vis-network@6.5.2/dist/vis-network.min.js npm引入:npm install vis 在关系图的页面引入vis:import Vis from ‘vis’ 在html中定义容器:<div id=”network_id”style=”height:800px”> 在scr...

qq_32900003的博客 3234

极简JEPA世界模型实战:低门槛复现LeWorldModel,CPU可跑

这次我们来看一个能让普通开发者真正上手跑起来的“世界模型”项目。如果你对Yann LeCun提出的JEPA(联合嵌入预测架构)框架感兴趣,但又苦于Meta官方实现过于庞大复杂,那么这个GitHub上4k star的项目就是为你准备的。它用极简的PyTorch代码(核心文件仅160-278行)完整复刻了包括LeWorldModel在内的五个JEPA核心变体,最大的亮点是: 门槛极低,普通笔记本甚至CPU就能跑,显存占用友好,非常适合学习和原理验证。 这个项目名为 keon/jepa ,完全开源。它剥离了工业级

weixin_29031161的博客 421

从零到一:在K210上实现YOLO模型在线训练与部署全流程

本文详细介绍了在K210芯片上实现YOLO模型在线训练与部署的全流程,涵盖数据采集、模型优化、量化转换及内存管理等关键环节。通过实战案例和代码示例,帮助开发者高效利用K210的超低功耗特性与YOLO模型的实时检测能力,适用于边缘计算和物联网应用场景。

weixin_29094539的博客 350

vuejs对象更新渲染_又学Vue系列:邂逅Vuejs

大家好,好久不见!距离上次更新已经有一个多月了,从九月以来陆续停更的主要理由是看了《活着》这部电影+小说,配合“努力不一定成功,但不努力一定会很舒服”毒鸡汤,让我这段时间颓废了一把(不得不说这段日子过得确实很舒服,王者荣耀还上最强王者了)。到最近一段时间,我终于重新稍微振作了一点,开始捡起之前写的自动化测试框架,继续研究。虽然之前学过几次Vue框架,但是在编写的过程中element-ui...

weixin_42497633的博客 139

Auto.js实现视频号点赞自动化

摘要:本文介绍了一个微信视频号自动化点赞的实现方案。通过定位点赞图标和数量容器,点击点赞按钮后检测点赞数变化,若发现取消点赞则自动补点。核心代码包括:1)获取点赞容器和图标;2)记录点赞前后数量;3)判断是否误取消并补点;4)循环执行点赞和滑动页面操作。该方案解决了滑动页面可能导致误取消点赞的问题,实现了自动化批量点赞功能。文章强调仅供学习参考,提醒勿滥用该技术。

分享前端工程化、AI 应用、Agent 开发与大模型实践! 2575

vis network(visjs)安装简单使用

vis.js可视化的出发点之一是它们可以处理动态数据,并允许对数据进行操作。为了实现这一点,vis.js包括一个基于灵活键/值 DataSet并DataView处理非结构化JSON数据的功能。 数据集DataSet,存储JSON的ID对象。可增删改查,过滤排序… 资料检视DataView,提供数据集上经过过滤或格式化的视图。通过订阅DataView中的更改,获取过滤或格式化的数据,而无需一直指定过滤器和字段类型 数据管道DataPipe,DataPipe从一个DataSet 获取数据DataView,对其

YouZi_X的博客 6006

开源免费!ReaLTaiizor如何用MIT许可证打造专业级WinForm UI?

摘要: ReaLTaiizor是一款开源UI控件库,为WinForm应用提供现代化界面解决方案。支持100+组件、多主题切换(浅色/深色/自定义)和.NET 4.8-8.0全版本兼容,MIT许可证允许免费商用。通过NuGet快速安装,3步改造传统界面:1)注入主题(如this.Theme = new Dark()),2)替换原生控件为高颜值组件(如ModernGrid替代DataGridView),3)集成高级功能(分页/动画提示)。典型场景包括登录界面美化(进度动画+通知控件)和数据表格Material风

墨夶的博客 1521

多线程开发的基本概念

在Android开发中,我们常常会遇到多线程开发的需求。由于Android中的,我们不能在主线程处理耗时逻辑,否则会导致卡顿,甚至出现ANR(应用无响应)等异常情况。因此,我们需要将网络请求等耗时操作放到中去执行,完成后再更新UI。多线程开发因此成为Android开发中的一个重要部分。随着Android开发技术的不断进步,从早期的使用Handler,到后来的RxJava,再到如今的Kotlin协程,切换线程以及并发编程的代码写起来是越来越简洁了。

喻志强的博客 1020

Vue.js中使用vis network出现的点和线更新问题

发现问题有一段时间,中文网一直没搜到结果,最终还是在github的已关闭issue里翻出了历史答案,简单翻译其中回答的部分内容,记录如下。 1.环境 前端工程vue.js,版本2.6.11。 vis-network版本5.4.1,在data()中定义全局变量network,初始化如下。 this.network = new vis.network(document.getElementB...

Mobile的专栏 3923

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

vuejs中使用echart图表

首先安装echart npm i echarts -S 加下来以使用这个图表为例 在vue组件中像这样使用: &lt;template&gt; &lt;div :class="className" :id="id" :style="{height:height,width:width}" ref="myEchart"&gt; &lt;/div&gt; &lt;/te

weixin_34362991的博客 321

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

vuejs的学习总结(四)

概述 v-show v-show的使用和v-if类似,也用于决定一个元素是否被渲染 v-show和v-if的区别: v-if和v-show都可以用来决定一个元素是否渲染 v-if为flase时,压根不会有对应的元素在DOM中 v-show对应为flase时,仅仅是将元素的display属性设置为none而已 开发过程中,我们应该如何选择呢? 当我们需要在显示与隐藏之间频繁切换时,使用v-show...

l118 235

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Vue 使用 vis-network 绘制网络关系图

visjs 提供了一个网络视图模块,提供给我们绘制网络之间的各个点、线之间的关系,这个的话就比较类似于echarts的地图,在地图上打点画线的逻辑,区别在于使用visjs可以拖动节点的位置、以及visjs里面还有对物理引擎等的引入。 网络是一种可视化,用于显示由节点和边组成的网络和网络。可视化易于使用,并支持自定义形状、样式、颜色、大小、图像等。网络可视化可在任何现代浏览器上流畅运行,最多可容纳数千个节点和边。为了处理大量节点,Network 支持集群。

共勉 1万+

vue中使用neovis和neo4j-driver渲染知识图谱

vue中使用neovis和neo4j-driver渲染知识图谱

qq_43509260的博客 462

js缩略图展示和js截屏

1、获取canvas页面展示缩略图,使用技术:vue+TS+visjs。 <template> <div id="minimapWrapper" class="wrapper minimapWrapperMove slide-minimap-open" > <img id="minimapImage" cl...

prey1025的博客 772

【JS】vis.js使用之vis-timeline使用攻略,vis-timeline在vue3中实现时间轴、甘特图

`vis-timeline`时间轴是一个交互式可视化图表,用于实时可视化时间数据。数据项可以只与某个时间点关联,也可以有开始和结束日期(即一个时间范围)。vis-timeline可以通过拖拽和滚动时间轴自由移动和缩放。可以在时间轴中创建、编辑和删除数据项目。轴上的时间尺度是自动调整的,支持从毫秒到年的尺度。 vis-time时间轴使用常规`HTML DOM`呈现时间轴和放在时间轴上的项目,这样的好处就是可以使用自定义css样式进行灵活定制。

余浩的博客 1万+

vue+ vis 编写星球图谱

vis.js vis.js是一个前端可视化框架,官方文档位置:http://visjs.org/docs/network/ 星球案例 vue中使用vis.js 安装 style 中有使用 less,所以需要安装一下; npm install vis --save npm install less less-loader --save 在需要使用的组件内引入vis import vis from 'vis' 定义dom <template> <div

aibujin的博客 3179

vis Network demo,源码开源 + (vue框架)

前段时间用到了,感觉不错,写了一个开源的demo,大家有兴趣的可以看看https://github.com/xiaohu12685/Network_demo_vis。 大体样子就是这样,看功能就好,界面请忽略; 就是这个vis,官网链接http://visjs.org/ ,本文提到的就是这个网络神经这一块 前端框架用的就是vue(vue没有用到任何技术含量); 这个demo...

王海虎的博客 4312
上一篇: Node.js API
下一篇: DIV+CSS(1.rem自适应)
BePowerful
博客等级 码龄10年 5粉丝 33原创
评论 4
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值