concept confidence level in category spark
appears as: confidence level, confidence level

This is an excerpt from Manning's book Spark in Action, Second Edition.
The way to do this is to use conditional functions such as
when()andotherwise(). If the confidence is less than or equal to 40, the confidence level is low. Otherwise, the confidence level isnull:int low = 40; int high = 100; ... .withColumn( "confidence_level" , col( "confidence" ).$less$eq( low ), "low" ))If the confidence is greater than 40 and less than 100, the confidence level is nominal. Otherwise, the confidence level remains at its current value (at this stage, the confidence level can be low or
null):.withColumn( "confidence_level" , when( col( "confidence" ).$greater( low ) .and(col( "confidence" ).$less( high )), "nominal" ) .otherwise(col( "confidence_level" )))