E
E
Evgeny Petryaev2021-12-17 14:06:11
Neural networks
Evgeny Petryaev, 2021-12-17 14:06:11

How long is the row for training neural networks?

I use something like a one-dimensional series for training a neural network, I select the coefficients of training epochs, but constantly one neuron takes almost everything, then another. A series of 1000 numbers.

%[old_path]=which('rdsamp'); if(~isempty(old_path)) rmpath(old_path(1:end-8)); end
%wfdb_url='https://physionet.org/physiotools/matlab/wfdb-app-matlab/wfdb-app-toolbox-0-10-0.zip';
%[filestr,status] = urlwrite(wfdb_url,'wfdb-app-toolbox-0-10-0.zip');
%unzip('wfdb-app-toolbox-0-10-0.zip');
%cd mcode
%addpath(pwd)
%savepath
cd D:\EGC\ptb-xl-a-large-publicly-available-electrocardiography-dataset-1.0.1\records100\00000
%cd C:\Users\Evgeny\Downloads\ptb-xl-a-large-publicly-available-electrocardiography-dataset-1.0.1\ptb-xl-a-large-publicly-available-electrocardiography-dataset-1.0.1\records100\00000
clc;
clear;
%Learning signals NORM
signal=[];
signalun=[];
fs=[];
[signal(1,1:1000,1:12), fs(1), tm] = rdsamp('00001_lr');
[signal(2,1:1000,1:12), fs(2), tm] = rdsamp('00002_lr');
[signal(3,1:1000,1:12), fs(3), tm] = rdsamp('00003_lr');
[signal(4,1:1000,1:12), fs(4), tm] = rdsamp('00004_lr');
[signal(5,1:1000,1:12), fs(5), tm] = rdsamp('00005_lr');
[signal(6,1:1000,1:12), fs(6), tm] = rdsamp('00006_lr');
[signal(7,1:1000,1:12), fs(7), tm] = rdsamp('00007_lr');
[signal(8,1:1000,1:12), fs(8), tm] = rdsamp('00009_lr');
[signal(9,1:1000,1:12), fs(9), tm] = rdsamp('00010_lr');
[signal(10,1:1000,1:12), fs(10), tm] = rdsamp('00011_lr');
[signal(11,1:1000,1:12), fs(11), tm] = rdsamp('00012_lr');
[signal(12,1:1000,1:12), fs(12), tm] = rdsamp('00013_lr');
[signal(13,1:1000,1:12), fs(13), tm] = rdsamp('00014_lr');
[signal(14,1:1000,1:12), fs(14), tm] = rdsamp('00015_lr');
[signal(15,1:1000,1:12), fs(15), tm] = rdsamp('00016_lr');
[signal(16,1:1000,1:12), fs(16), tm] = rdsamp('00019_lr');
[signal(17,1:1000,1:12), fs(17), tm] = rdsamp('00021_lr');
[signal(18,1:1000,1:12), fs(18), tm] = rdsamp('00024_lr');
[signal(19,1:1000,1:12), fs(19), tm] = rdsamp('00025_lr');
[signal(20,1:1000,1:12), fs(20), tm] = rdsamp('00027_lr');
[signal(21,1:1000,1:12), fs(21), tm] = rdsamp('00029_lr');
[signal(22,1:1000,1:12), fs(22), tm] = rdsamp('00031_lr');
[signal(23,1:1000,1:12), fs(23), tm] = rdsamp('00033_lr');
[signal(24,1:1000,1:12), fs(24), tm] = rdsamp('00035_lr');
[signal(25,1:1000,1:12), fs(25), tm] = rdsamp('00036_lr');
[signal(26,1:1000,1:12), fs(26), tm] = rdsamp('00037_lr');
[signal(27,1:1000,1:12), fs(27), tm] = rdsamp('00038_lr');
[signal(28,1:1000,1:12), fs(28), tm] = rdsamp('00040_lr');
[signal(29,1:1000,1:12), fs(29), tm] = rdsamp('00042_lr');
[signal(30,1:1000,1:12), fs(30), tm] = rdsamp('00043_lr');

%...etc
%Learning signals IMI

[signalun(1,1:1000,1:12), fsu(1), tm] = rdsamp('00008_lr');
[signalun(2,1:1000,1:12), fsu(2), tm] = rdsamp('00039_lr');
[signalun(3,1:1000,1:12), fsu(3), tm] = rdsamp('00103_lr');
[signalun(4,1:1000,1:12), fsu(4), tm] = rdsamp('00139_lr');
[signalun(5,1:1000,1:12), fsu(5), tm] = rdsamp('00142_lr');
[signalun(6,1:1000,1:12), fsu(6), tm] = rdsamp('00146_lr');
[signalun(7,1:1000,1:12), fsu(7), tm] = rdsamp('00153_lr');
[signalun(8,1:1000,1:12), fsu(8), tm] = rdsamp('00161_lr');
[signalun(9,1:1000,1:12), fsu(9), tm] = rdsamp('00175_lr');
[signalun(10,1:1000,1:12), fsu(10), tm] = rdsamp('00181_lr');
[signalun(11,1:1000,1:12), fsu(11), tm] = rdsamp('00210_lr');
[signalun(12,1:1000,1:12), fsu(12), tm] = rdsamp('00234_lr');
[signalun(13,1:1000,1:12), fsu(13), tm] = rdsamp('00240_lr');
[signalun(14,1:1000,1:12), fsu(14), tm] = rdsamp('00257_lr');
[signalun(15,1:1000,1:12), fsu(15), tm] = rdsamp('00258_lr');
[signalun(16,1:1000,1:12), fsu(16), tm] = rdsamp('00266_lr');
[signalun(17,1:1000,1:12), fsu(17), tm] = rdsamp('00267_lr');
[signalun(18,1:1000,1:12), fsu(18), tm] = rdsamp('00269_lr');
[signalun(19,1:1000,1:12), fsu(19), tm] = rdsamp('00270_lr');
[signalun(20,1:1000,1:12), fsu(20), tm] = rdsamp('00281_lr');
[signalun(21,1:1000,1:12), fsu(21), tm] = rdsamp('00290_lr');
[signalun(22,1:1000,1:12), fsu(22), tm] = rdsamp('00323_lr');
[signalun(23,1:1000,1:12), fsu(23), tm] = rdsamp('00325_lr');
[signalun(24,1:1000,1:12), fsu(24), tm] = rdsamp('00337_lr');
[signalun(25,1:1000,1:12), fsu(25), tm] = rdsamp('00380_lr');
[signalun(26,1:1000,1:12), fsu(26), tm] = rdsamp('00383_lr');
[signalun(27,1:1000,1:12), fsu(27), tm] = rdsamp('00407_lr');
[signalun(28,1:1000,1:12), fsu(28), tm] = rdsamp('00423_lr');
[signalun(29,1:1000,1:12), fsu(29), tm] = rdsamp('00429_lr');
[signalun(30,1:1000,1:12), fsu(30), tm] = rdsamp('00442_lr');
%etc
t=[];
t=[-2;2];
net = newc(minmax(t),2);
net.inputs{1}.size = 1000;
net = init(net);
d=[];
d2=[];
s=[];
su=[];
    for jj=1:1:30
        %clc
        for jjj=1:1000
        for k=1:12
            s(jjj,k) = signal(jj,jjj,k);
            su(jjj,k) = signalun(jj,jjj,k);
        end
        end
        z=smoothdata(s);
        zu=smoothdata(su);
        x=sgolayfilt(z,0,15);
        xu=sgolayfilt(zu,0,15);

        net.trainParam.epochs = 500;
        net=train(net,x,[1 1 1 1 1 1 1 1 1 1 1 1 ;0 0 0 0 0 0 0 0 0 0 0 0]);
        net=train(net,xu,[0 0 0 0 0 0 0 0 0 0 0 0;1 1 1 1 1 1 1 1 1 1 1 1]); 
    end
count1 = 0;
count2 = 0;
    for jj=1:1:30
        %clc
        for jjj=1:1000
        for k=1:12
            s(jjj,k) = signal(jj,jjj,k);
            su(jjj,k) = signalun(jj,jjj,k);
        end
        end
        z=smoothdata(s);
        zu=smoothdata(su);
        x=sgolayfilt(z,0,15);
        xu=sgolayfilt(zu,0,15);
        disp('перший:');
        y=sim(net,x);
        count = 0;
        for j=1:2:23
            if y(j) == 1
                count=count+1;
            end
        end
        if count > 6
            count1=count1+1;
            disp('перший=');
            jj
        end
        disp('второй:');
        y2=sim(net,xu);
        count = 0;
        for j=2:2:25
            if y2(j) == 1
                count=count+1;
            end
        end
        if count > 6
            count2=count2+1;
            disp('второй=');
            jj
        end
        d = [d y];
        d2 = [d2 y2];
    end
count1
count2

Answer the question

In order to leave comments, you need to log in

6 answer(s)
D
dmshar, 2021-12-17
@dmshar

How can we "treat" the patient if he (your code) has not even been seen. What is a neuron? Self-written? Ready? What architecture? How many layers?
But what is the question -
How long is the row for training neural networks?
and so is the answer:
The longer, the better.

M
Mikhail Osher, 2015-07-19
@miraage

https://gist.github.com/miraage/d00534fedd7d330a3849

/**
 * Format number from 5251.25 to "5 251.25"
 * 
 * @param num
 * @returns {string}
 */
function numberFormat(num) {
    if (!isFinite(num)) {
        return num;
    }
    
    var parts = num.toString().split('.');
 
    parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ' ');
 
    return parts.join('.');
}

D
Daniil Kolesnichenko, 2015-07-19
@KolesnichenkoDS

function numberFormat(num) {
  if (typeof num !== "string") {
    return numberFormat(num.toString())
  } else {
    if (num.length < 4) {
      return num
    } else {
      return numberFormat(num.slice(0, num.length - 3)) + " " + num.slice(num.length - 3)
    }
  }
}

C
coderlex, 2015-07-19
@coderlex

/**
 * Formats given number with comas, i.e for given
 * `12345` returns `"12,345"`.
 * The second (optional) argument redefines default
 * thouthands delimiter (comma).
 */
thouthands: function(n, delim) {
  delim = delim != undefined ? delim : ','
  x = (n + '').split('.')
  x1 = x[0]
  x2 = x.length > 1 ? '.' + x[1] : ''
  var rgx = /(\d+)(\d{3})/
  while (rgx.test(x1)) {
    x1 = x1.replace(rgx, '$1' + delim + '$2')
  }
  return x1 + x2
}

A
Alexey, 2015-07-19
@dzheka3d

The same story, only now 10 million are broken like this 1000 0000,
100 million are broken correctly 100 000 000
1 billion is already like 100000 0000
And like this every other time

V
Vladislav Khelsov, 2019-03-27
@helsov

function myFunc(count){
    let event = count.toFixed(2);
    event = parseFloat(event);
    return event.toLocaleString();
};

myFunc(1005006.525);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question