Integration to refinery

In refinery, sometimes you might want to run a code snippet for which there already is a brick module.

To make it easier for you to know what brick modules are available to be imported in refinery, there is a bricks integration feature which helps you to import a brick module for your use case. The integrator asks you to assign a value to the user defined variables or change the default values of the variables as needed. Once provided, the code is ready to be run in refinery.

An important thing to remember is that the bricks integration is highly dependent on the refinery version you might be using. If you are using an older version of refinery, chances are that you cannot access some of the brick modules which are only compatible with the newer version. The refinery version is visible on the bottom left panel of refinery.

This section provides a demonstration of using bricks in a refinery project using the bricks integration. For this documentation, we will use the “language detection” brick module.

For starters, we can create a new attribute on the settings page by clicking the Add new attribute button.

Fig. 1: Adding a new attribute to refinery.

Once you click Add attribute you will be redirected to this newly created attribute page, where the editor would look like this:

Fig. 2: Details of the attribute calculation.

As you can see, there are two options: Search in bricks and Start from scratch . The first option is the gateway to the bricks integration feature which opens a prompt where you can select any of the available bricks for your project, as shown below.

Fig. 3: Pick a brick from the setup wizard.

Once you have selected the module to import, you can go through the overview of the module which contains information and a link that redirects you to that module on bricks. If you want to know what a specific brick does, or need an example, you can navigate to Input example which has a default input that is also imported from bricks, and you can modify it to perform test runs.

Fig. 4: See an input example.

Clicking the Request Example button generates the output that you expect to see for that default/user-defined input. Likewise, the Reset to default resets the prompt to its initial state.

The last part is the Integration feature which consists of fields that take user-defined values.

Fig. 5: Choose the attributes for the input.

Once you have the variables set, you can look through the final code and changes.

Fig. 6: Final review of your brick setup.

Lastly, you can click on Finish up and the code from bricks will be imported to the editor on the attribute page, as shown

Fig. 7: The integrated brick in your refinery module.

And you are set! To test it out, you can run the code on 10 samples by clicking the button below the code editor and the output shall be generated in no time!

Fig. 8: First results of the language detection module.

Bricks integration makes it more convenient for you to simply access the module without any hassles of finding the module specifically on the bricks app and worry if the module is compatible with your current refinery version or not. Apart from that, the above example was for attribute calculation, for which only classifiers or generators are to be used. In a similar fashion, you can use the bricks integration while creating a new heuristic - be it a labelling function (classifier/extractor) or an active learner.