Hypothesis test and point-biserial correlation coefficient

Let be $ X$ and $ Y$ two random variables which are respectively continuous and binary. Assume that we have a sample $ (X_i, Y_i)_{1\leq i\leq n}$ . We define the point-biserial correlation coefficient as below : $ $ r_{X,Y} = \frac{m_1 – m_0}{\hat{s}_X} \sqrt{\frac{n_0n_1}{n(n-1)}} $ $ $ m_k$ is the mean of the $ n_k$ elements $ x_i$ whose corresponding $ y$ values are $ y_i=k$ , $ k \in \{0,1\}$ . $ \hat{s}_X = \sqrt{\frac{1}{n-1} \sum_{i=1}^n (x_i – \bar{x})^2}$ and $ \bar{x} = \frac{1}{n} \sum_{i=1}^n x_i$ .
I have some questions about this coefficient. I got it on the web, but it looks strange for me. Why it is $ m_1-m_0$ and not $ m_0-m_1$ ? I think that they forget the absolute value, but I do not know. The fact is that there more than one website that write this coefficient without an absolute value.
Also, can someone explain how to test if this coefficient is not zero ?
Thanks in advance 🙂

Documenting business logics of legacy application having no unit test

I have joined a team in company and this team owns few services, which are used widely by many other user facing internal/external UI apps and other internal apis.

My manager gave me rough idea that these services are responsible for, let’s assume, around $ 1B worth of traffic, or something like, so idea was, it’s super critical.

There are tons of business logic, lots of if/else in c# code. Also sql Stored procedures and sql function are used. I have worked in these kind of code in past also, so I know these services are complicated too.

System mainly in maintenance mode, so no frequent code changes.

There are no unit tests and very minimum documentation.

There is an effort going on to rewrite these services side by side, without modifying this existing, and some migration plan. My manager want me to understand business.

Need for frequent releases, data issues in this monolithic in various environment, old infrastructure and high maintenance causing money, are few reasons. There is an initiative for cloud Native microservices in my organization.

In past, for these kind of scenario, I wrote integration test first. But this time I am trying to write this in BDD style, not sure if this going to be a right approach. I never worked with BDD, but read about it. Seems output of BDD is good documentation, with other benefits. Nevertheless my ultimate aim to document business logics so that we can use it while rewriting this application. Refactoring seems not an option here.

Suggest me if I am going in right direction, any other points I should take care of, on effective documentation of business logics.

Rails 5 Engine: Devise methods not defined in Controllers in test environment

I’m using Devise(4.6.2) in a Rails Engine(5.2.3) and everything works fine in development. In my Rspec(3.8.2) controller tests, the Devise method current_user and before_action authenticate_user! both say undefined.

I’ve include in my rails_helper file:

config.include Devise::Test::ControllerHelpers, type: :controller 

but that has no effect.

Arc welder Launch App, test, and Download Zip buttons not showing

My arc welder has been broken for some time now I can’t find any other questions on how to fix this so I thought I would ask myself. my arc welder is missing the “Launch App”, “Download Zip”, and “test” buttons. it has been broken for some time now. it has worked in the past but I don’t know exactly when it stopped working. I don’t believe that it became broken from an update to the app because I’ve seen other people that have it working and I haven’t done anything to anything that I could think of related to the app except I have tried a lot of flags in “Chrome://flags” but because none of those have worked I have restored to default and its still broken.

screenshot of app

Is it okay to compare Test BLEU score between NMT models while using a slightly modified standard test sets?

I am using tst2013.en found at https://nlp.stanford.edu/projects/nmt/data/iwslt15.en-vi/ as my test sets to get the Test BLEU score to compare to other previous models. However, I have to filter out some sentences that are longer than 100 words otherwise I won’t have the resource to run the model.

But with a slightly modified test sets, is it acceptable to compare the Test BLEU score to other models that use the unmodified test sets?

Unit test for functions that out put data frames

I am very much new to the unit testing. i am writing a code which has functions

  1. import a data frame
  2. pre process the data frame
  3. export the final data

task is to write unit testing for all the functions individually with 2 different datasets in loop with time taken to run every unit test

each function is giving a dataset.

here is the function for data import

def data_import(): df = spark.sql(data) df2 = df.topandas() return df,df1 

Test for the existence or nonexistence of a periodic solution

Discuss the existence or nonexistence of a periodic solution for the following equation. Find the region where your result holds.

x” + (3-(x’)^2)x’ + x = 0

At first glance, I thought this was the Lienard Equation until I seen the fact that the equation isn’t linear. So I decided to use the Brendixon negative test.

I started off by creating a system of equations: y = x’ and y’ = x”

After, I took the derivative of x’ with respect to x and took the derivative of y’ with respect to y:

fx = 0 and fy = – 3 – 3y^2

When adding these two together, I got fx + fy = 0 – 3 – 3y^2.

I concluded that this doesn’t change sign. We can only jump from 0 to positive results. There is nothing we can say about the existence of a periodic solution. Does 0 count as changing sign? If so, then my conclusion is incorrect.

I tried the critical points idea after. For my critical point(s), I got (0,0). I plugged into the Jacobian and didn’t get a saddle point so we can comment on the existence or nonexistence of a periodic solution here either.

I do know of a couple of tests that tests for the existence of a periodic solution. One of them is the Pioncare-Brendixson theorem. I’m not sure how to use it though.

Here’s the theorem I was given: “Let R be an invariant region for a plane autonomous system and suppose that R has no critical point on the boundary. Then

  1. If R is a simply connected region that has a single unstable node or unstable spiral point in it’s interior, then there’s at least one periodic solution in R.

  2. If R is an annular region that contains no critical point of the system, then there is at least one periodic solution in R.”

How do you use this theorem? Also, how do I find the region where my result holds? I have no idea on how to do that.

how to test input image from pre trained CNN model

i have saved my CNN model in .pth file. Using Pytorch. I want to predict input image from my .pth file .I m getting this error. File “C:/Users/MS/PycharmProjects/GUI_last/test.py”, line 148, in print(‘Accuracy of the network on the test images: %d %%’ % ( 100 * (correct) /total)) ZeroDivisionError: division by zero

Process finished with exit code 1 and my code is here

    def testing(self):          model=torch.load("last_brain1.pth")         print(model)         criterion = nn.CrossEntropyLoss()         optimizer = optim.SGD(model.parameters(), lr=0.001, momentum=0.9)         loss = 0.0         correct = 0         total = 0.0         itr = 0         model.eval()         trainloss = []         testloss = []         trainaccuracy = []         testaccuracy = []         itr = 0;         itrloss = 0         itr = 0          for images, labels in testloader:             images = Variable(images)             labels = Variable(labels)             # CUDA=torch.cuda.is_available()             # if CUDA:             # images=images.cuda()             # labels=labels.cuda()             outputs = model[images]             loss = criterion(outputs, labels)             loss += loss.item()             _, predicted = torch.max(outputs, 1)             total += labels.size(0)             correct += (predicted == labels).sum()             itr += 1         testloss.append(loss / itr)         testaccuracy.append((100 * correct / len(testset)))           print('training loss:%f %%' % (itrloss / itr))         print('training accuracy:%f %%' % (100 * correct / len(model)))         print('test loss:%f %%' % (loss / itr))         print('test accuracy:%f %%' % ((100 * correct / len(testset)))) loss = 0.0 correct = 0 total=0 itr = 0  #print('Accuracy of the network on the  test images: %d %%' % (   100 * (correct) /total)) class_correct = list(0 for i in range(3)) class_total = list(0 for i in range(3)) with torch.no_grad():     model=torch.load("last_brain1.pth")     for data in testloader:          images,labels = data         images = Variable(images)         labels = Variable(labels)         outputs = model[images]         _, predicted = torch.max(outputs, 1)         c = (predicted == labels).squeeze()         # class_total=[]         for i in range(labels.size(0)):             label = labels[i]             class_correct[label] += c[i].item()             class_total[label] += 1 for i in range(3):     print('Accuracy of %5s : %2f %%' % (classes[i], 100 * class_correct[i] / class_total[i])) 

In Go, how do you setup a black box test package with a local dependency import?

I’m trying to setup blackbox testing of my go package. I’ve read this answer on blackbox testing in Go, using the package myfunc_test strategy, also discussed in these posts: Lesser-Known Features of Go Test and Structuring Tests in Go.

The problem with this approach, is how to import the local copy of the library under test?

This is the example from Structuring Tests in Go:

user.go:

package myapp type User struct {     id int     Name string } func (u *User) Save() error {     if u.id == 0 {         return u.create()     }     return u.update()  } func (u *User) create() error { ... } func (u *User) update() error { ... } 

user_test.go:

package myapp_test import (     "testing"     . "github.com/benbjohnson/myapp" ) func TestUser_Save(t *testing.T) {     u := &User{Name: "Susy Queue"}     ok(t, u.Save()) } 

Both files are in the same directory (this is the one case where you can have two packages in the same directory).

The problem here is that the testing will be done against the remote copy of the library under test (from github.com/benbjohnson/myapp in this example). How can I execute this blackbox test against my local copy of the library? This is necessary during development, and pre-merge Ci runs.