question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implement assertions() in search methods

See original GitHub issue

Thanks to @SioKCronin , we’re now able to implement hyperparameter search tools such as GridSearch and RandomSearch . These are awesome implementations, but we can maximize its robustness by adding an assertions() method in our classes. Would you like to try?

What you’ll do

Simply put, you will just add an assertions() method in the SearchBase class. This should contain various checks when instantiating any class that inherits from it. You can check the docstrings for each class and create a proper method call for it.

If you want to check previous implementations, see the SwarmBase.assertions method, and check how it is being implemented in GlobalBestPSO (it is not called explicitly because it just inherits from the base) or in LocalBestPSO (additional lines of code were added after calling the super() because of extra attributes).

Go the extra mile?

If you want to go the extra mile, you can add tests to check for edge cases and see if your assertions are working when passed with an invalid input (maybe an invalid type, out-of-bounds, etc.). For this, you just need to add an Instantiation class in the test.utils.search.test_gridsearch and test.utils.search.test_randomsearch modules.

Again, if you want a template, you can check the Instantiation classes in test.optimizers.test_global_best and others. Notice how we try to feed the class with invalid arguments/edge cases and have the unit test capture them. It’s a very fun activity!

If you wish to take this on, then feel free to drop a comment here! I’d be glad to help you!

Update: 9/17/2017

Follow the instructions in this quick-start guide to get you started!

Commit Guidelines

I’d appreciate if we lessen the number of commits per issue to 1-2. Of course you can commit often, but before merging, I would ask you to rebase them depending on the changes you’ve done. A commit format that we follow is shown below:

Short and sweet imperative title  (#27)

Description of the commit. The commit title should be short
and concise, and must be in imperative form. It could be as
simple as `Add tests for optimizer` or `Implement foo`. It describes
the "what" of the commit. You must also reference the issue, if any,
in the title. Here, in the description, we explain the
"why" of the commit. This is more or less free-for-all. So you can
describe as detailed as possible, in whatever tense/form you like.

Author: <your-github-username>
Email: <your-email>

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:32 (32 by maintainers)

github_iconTop GitHub Comments

2reactions
jazcap53commented, Sep 16, 2017

@ljvmiranda921 Making good progress on #27. Just had to overcome a little nervousness 😃

1reaction
jazcap53commented, Oct 3, 2017

Hi Lester @ljvmiranda921 ,

Great! I’ll finish up and check my work tomorrow morning!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Assertion Methods and its Implementation Part I (Tutorial #2 )
A Complete overview of Assertion Methods and Implementation View the Full tutorial here:Here you will learn how to implement Assertion ...
Read more >
Assertions In Selenium Using Junit And TestNG Frameworks
Assertfalse and assertequals methods compare if the actual page title of the search results screen matches with that of the expected title –...
Read more >
Assert and Verify Methods in Selenium | BrowserStack
assertEquals() is a method that takes a minimum of 2 arguments and compares actual results with expected results. If both match, the assertion...
Read more >
Programming With Assertions - Oracle Help Center
An assertion is a statement in the Java TM programming language that enables you to test your assumptions about your program. For example,...
Read more >
Assertions in Java - GeeksforGeeks
The assert statement is used with a Boolean expression and can be written in two different ways. First way: assert expression;. Second way:....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found