Created
May 2, 2018 15:38
-
-
Save FavioVazquez/dcd72fe4f0f4204736d46ba57112cb97 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyspark.sql.types import DoubleType | |
from pyspark.sql.functions import expr | |
from pyspark.sql.functions import * | |
from pyspark.sql.types import * | |
def _p1(v): | |
return float(v.array[1])y | |
take_one = udf(_p1, DoubleType()) | |
df = tested_df.withColumn("p", take_one(tested_df.probability)) | |
wrong_df = df.orderBy(expr("abs(p - label)"), ascending=False) | |
wrong_df.select("image.origin", "p", "label").show(10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment