> Hugo tranquilpeak theme
1. Dichotomy def sqrt(x, e=1e-6): if x<0: return -1 # error if x==0: return 0 if x < 1: a, b = x, 1 else: a, b = 0, x while b-a > e: m = (a+b)/2 if m*m > x: b = m else: a = m return (a+b)/2 Time complexity: $$ \frac{x}{2^{f(n)}} < e \ f(n) > log2(x/e) $$ Since e is usually a fixed number, the time complexity is $O(log(x))$

Continue reading

MySQL Char & Index

1. Types of char Type Size Range Extra Space Query Speed CHAR Fixed 1~255 0 fast VARCHAR Dynamic 1~65535 1~2 bytes slow TEXT Dynamic 1~65535 2 bytes slowest 2. Index Create index for database can speed up query. 2.1 How to create index create index idx_name on employee(name); -- or alter table employee add index idx_name(name); -- unique index create unique index idx_name on employee(name); 2.2 How to check index show index from employee; 2.

Continue reading

Router & CORS

1. Basic Setting We are developing a web applications. Gin is for backend and vue is for frontend. However, I often encouter router problems when sending request from frontend to the backend. Here are quick rules to avoid these problems. 2. Router //routers.go func Router() *gin.Engine { r := gin.Default() r.Use(middleware.Cors()) user := r.Group("/user") { user.GET("/test/", controllers.Test) user.GET("/", controllers.GetUsers) user.GET("/:id", controllers.GetUser) user.POST("/new", controllers.NewUser) user.POST("/update/:id", controllers.UpdateUser) } return r } <script> // add end slash const res = await $fetch("http://localhost:8080/user/test/") const res = await $fetch("http://localhost:8080/user/"); // no end slash const res = await $fetch("http://localhost:8080/user/1"); const res = await $fetch("http://localhost:8080/user/new", { .

Continue reading

1. Relative Attributes Extract emotion related features by OpenSMILE toolkit. (384-dim) Train Ranking function (Linear) based on the RA. Normalize the intensity values to the range 0 ~ 1. 2. Intensity Distribution 3. Intensity Embedding Map the real number to high dimensional embedding: (effective) $$Inty*W$$ Combine the neutral and emotional embeddings: (not so effective) $$Neu*(1-Inty)+Emo*Inty$$ Combine the neutral and emotional embeddings: (To be done) $$Neu.detach()(1-Inty)+EmoInty$$

Continue reading

Trap of Javascript

1. Reference before assignment function ShuffleArray(array){ // inplace for (let i=array.length-1; i>0;i--){ var j = Math.floor(Math.random()*(i+1)); [arr[i], arr[j]] = [arr[j], arr[i]]; // no error } } This function not only cannot modify the array, but also affects the global variables! 2. Pass by reference (2d array) arr1 = [[0,0], [1,1]]; arr2 = arr1; console.log(arr1); // output: [[3,0], [1,1]] ??? // console.log(...arr1) instead arr2[0][0] = 3; console.log(arr2); // output: [[3,0], [1,1]] The output will be changed even before the assignment.

Continue reading

Trouble of life

Chapter two As temperature grows colder, I tend to get up late in the morning. The result is that I find myself getting ready to sleep without doing anything useful. I have been living in anxiety and depression. Life seems to be out of my control. I want to change the status quo, but it is not easy. My parents are getting old, but I can’t stay with them. I have to continue my research until graduation, but I have no good experimental results yet.

Continue reading

1. Notes (1) We can’t regard different non-neutral speech pair as similar set, otherwise the emotional intensity labels attract each other. (2) The intensity predictor should be fixed while training the text-to-speech model, otherwise the intensity cannot be controlled. (maybe because the label for each sample always fluctuates)

Continue reading

Author's picture

LI WEI

苟日新,日日新,又日新

Not yet

Tokyo