In this guide we'll write a function to determine whether a comment is spam. By showing Nyckel examples of good comments and spam comments, we can train our function to tell the difference.
If you haven't already, sign up or log in to Nyckel by clicking 'Get Started' in the upper right corner.
If this is your first time on Nyckel, you're automatically directed to the New Function page. If you're signed into an account that already has functions, click the 'New Function' button.
This indicates that you'll provide textual data train your function.
Tell Nyckel which categories are allowed; create two labels named 'spam' and 'not spam' - we'll use these exact names later to speed data import.
Click here to download comment data you can use to train your function.
Click anywhere inside the dashed blue box to open the file dialog.
Select the file you downloaded in step 1.
Set 'First row contains column names' to 'True'.
Click the column titled 'Comment' to indicate it contains the input data.
Click the column titled 'Is Spam' to indicate it contains the output data.
Wait ~20 seconds as Nyckel imports the CSV and trains your function. You can watch the status bars update as the data is imported and the accuracy bars adjust as your functions initial accuracy is calculated. Note that a few of the sample inputs don't have outputs... Nyckel will give you the opportunity to annotate those manually in the UI.
Now we'll experiment with entering different inputs into our trained function to see how it does. Click on 'Invoke' in the left nav to get started.
Enter something you would expect the function to say is not spam, such as
Wow this is a great post!
, then click 'Invoke'. Check the 'Function Output' to
verify it correctly predicts that the comment is not spam.
Enter something you would expect the function to say IS spam, such as
Thanks to @super_mom_31 I learned how to make $15,000 per month doing nothing!
,
and click 'Invoke'. Check the 'Function Output' to verify it correctly predicts
that the comment is spam.
Now, copy the curl request provided and paste it into a command prompt.
Check out the full API Reference to learn about how to integrate Nyckel functions into your application.Congrats! You just built a function that can tell the difference between real and spam comments... for this data at least. Upload your own data to build a custom function that serves your needs!