(mlp, options)
| 1853 | |
| 1854 | class NeuralVisualizer { |
| 1855 | constructor(mlp, options) { |
| 1856 | this.mlp = mlp; |
| 1857 | this.options = Object.assign( |
| 1858 | { |
| 1859 | layerSpacing: 5.5, |
| 1860 | inputSpacing: 0.24, |
| 1861 | hiddenSpacing: 0.95, |
| 1862 | outputSpacing: 0.95, |
| 1863 | inputNodeSize: 0.18, |
| 1864 | hiddenNodeRadius: 0.22, |
| 1865 | maxConnectionsPerNeuron: 24, |
| 1866 | connectionRadius: 0.005, |
| 1867 | connectionWeightThreshold: 0, |
| 1868 | outputLabelOffset: 0.65, |
| 1869 | outputLabelScale: 0.48, |
| 1870 | showFpsOverlay: false, |
| 1871 | }, |
| 1872 | options || {}, |
| 1873 | ); |
| 1874 | this.focusChangeCallback = |
| 1875 | typeof this.options.onNeuronFocusChange === "function" ? this.options.onNeuronFocusChange : null; |
| 1876 | delete this.options.onNeuronFocusChange; |
| 1877 | this.layerMeshes = []; |
| 1878 | this.connectionGroups = []; |
| 1879 | this.selectionConnectionGroups = []; |
| 1880 | this.tempObject = new THREE.Object3D(); |
| 1881 | this.tempColor = new THREE.Color(); |
| 1882 | this.tempQuaternion = new THREE.Quaternion(); |
| 1883 | this.upVector = new THREE.Vector3(0, 1, 0); |
| 1884 | this.highlightColor = new THREE.Color(0x4da6ff); |
| 1885 | this.outputLabels = []; |
| 1886 | this.selectedNeuron = null; |
| 1887 | this.lastDisplayActivations = null; |
| 1888 | this.lastNetworkActivations = null; |
| 1889 | this.lastPreActivations = null; |
| 1890 | this.currentSelectionDetail = null; |
| 1891 | this.selectionCylinderGeometry = null; |
| 1892 | this.selectionConnectionRadiusMultiplier = 1.2; |
| 1893 | this.selectionConnectionData = null; |
| 1894 | this.selectionGlowSprite = null; |
| 1895 | this.maxConnectionWeightMagnitude = 0; |
| 1896 | this.raycaster = new THREE.Raycaster(); |
| 1897 | this.pointerVector = new THREE.Vector2(); |
| 1898 | this.pointerDown = null; |
| 1899 | this.initThreeScene(); |
| 1900 | this.buildLayers(); |
| 1901 | this.buildConnections(); |
| 1902 | this.animate(); |
| 1903 | } |
| 1904 | |
| 1905 | initThreeScene() { |
| 1906 | this.scene = new THREE.Scene(); |
nothing calls this directly
no test coverage detected