Skip to main content

Posts

Showing posts from 2020
 Sự khác nhau giữa độ chính xác (Precision) và độ nhắc lại (Recall). (Viết lại) Predicted \Fact:           Positives  |    Negatives Positives        ||               TP            |       FN  -------------   --------------------------- Negatives       ||               FP            |       TN Độ chính xác mô tả ý nghĩa như sau:  Giả sử ta có một quần thể cần tìm ra trong quần thể có bao nhiêu cá thể dương tính (Positives) và bao nhiêu cá thể âm tính (Negatives).  Một phương pháp A có độ chính xác (precision) 80% có nghĩa là nếu ta thực hiện 100 mẫu kiểm định và phát hiện ra 40 mẫu có phát hiện  có dương tính trong đó, thì với độ chính xác 80%, khả năng là 40*0.8 = 32  mẫu là dương tính ...

Applying neural network for 1D-signal ppg

 In this post, I jot down some useful thing need to notice when trying to test a model with Python and Keras for newbies like me. First, segment data with python command Second, organization data to fit the built-in model in Keras Third, experience with training model with preprocessing data with MinMaxScaler. 1. Segment Data with Python In python to import data, the easy and regular way is employing `read_csv` function from pandas package. File format often in .txt, .csv, or .xls but prefer to save and load .csv file because I can explore, verify, and manipulate on Excel software confidently. Let's start by read a csv file name "InvertPhaseLong2.csv" as below from  pandas  import  read_csv dataset = read_csv( 'drive/My Drive/InvertPhaseLong2.csv' , header= 0 ) header= 0 mean the file contains a header in the first rows, in case we do not care header then let set it as header=None The file dataset is in the format of pandas as DataFrame so in this...
Programing on Launchpad MSP432 Interrupt button Prerequisite: Hardware: Launchpad MSP432P401 IDE software: IAR/CCS/KEIL Tool: Simplelink SDK MSP432 v3.20.00.06 Description: Simple program using two buttons connected to P1.0  and P1.4 to turn on or turn off LED on P1.0 Step1. Open example of Simplelink SDK without RTOS Step2. modify the code as below Step3. Compile and debug the program /* DriverLib Includes */ #include <ti/devices/msp432p4xx/driverlib/driverlib.h> /* Standard Includes */ #include <stdint.h> #include <stdbool.h> volatile uint32_t SW1, SW2; //semaphores void VectorButtons_Init(void){   __disable_interrupt;   //DisableInterrupts();          // set the I bit during initialization   SW1 = 0; SW2 = 0;             // clear semaphores   P1->SEL0 &= ~0x12;   P1->SEL1 &= ~0x12;      P1->D...

AFE4300 with Arduino Due

In this post, I make an experiment to use Arduino Due to control AFE4300 for measuring in BCM mode. The code based on a guy in this link from Arduino Forum https://forum.arduino.cc/index.php?topic=319141.0 However, this not work now because the SPI library now have changed to new style and really different if you want control Clock of SPI with the command SPI.setClockDevider(). Actually, if you use this function to control SPI, the clock of SCLK keep around 4Mhz and it gives incorrect data when you communicate with AFE4300. For solving it, you need to rewrite two functions writeRegister() and readRegister() as below: void writeRegister(unsigned char address, unsigned int data) { unsigned char firstByte = (unsigned char)(data >> 8); //LA CARA ES UN OCHO) unsigned char secondByte = (unsigned char)data; SPI.beginTransaction(SPISettings(1000000, MSBFIRST, SPI_MODE1)); digitalWrite(SS,LOW); SPI.transfer(address); //Send 2 bytes to be written SPI.transfer(firstBy...
Some stuff are useful for C# programming Dial, KNob, Button and LED indicator https://www.codeproject.com/Articles/36116/Industrial-Controls-2 Gauge https://www.codeproject.com/Articles/448721/AGauge-WinForms-Gauge-Control http://www.codearteng.com/2012/08/agauge-winforms-gauge-control.html Scott Plot https://github.com/swharden/ScottPlot#cookbook DSP toolbox http://www.codearteng.com/2012/08/agauge-winforms-gauge-control.html