Class: Google::Apis::LanguageV2::XpsVisualization

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
lib/google/apis/language_v2/classes.rb,
lib/google/apis/language_v2/representations.rb,
lib/google/apis/language_v2/representations.rb

Overview

Visualization configurations for image explanation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ XpsVisualization

Returns a new instance of XpsVisualization.



5109
5110
5111
# File 'lib/google/apis/language_v2/classes.rb', line 5109

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#clip_percent_lowerboundFloat

Excludes attributions below the specified percentile, from the highlighted areas. Defaults to 62. Corresponds to the JSON property clipPercentLowerbound

Returns:

  • (Float)


5070
5071
5072
# File 'lib/google/apis/language_v2/classes.rb', line 5070

def clip_percent_lowerbound
  @clip_percent_lowerbound
end

#clip_percent_upperboundFloat

Excludes attributions above the specified percentile from the highlighted areas. Using the clip_percent_upperbound and clip_percent_lowerbound together can be useful for filtering out noise and making it easier to see areas of strong attribution. Defaults to 99.9. Corresponds to the JSON property clipPercentUpperbound

Returns:

  • (Float)


5078
5079
5080
# File 'lib/google/apis/language_v2/classes.rb', line 5078

def clip_percent_upperbound
  @clip_percent_upperbound
end

#color_mapString

The color scheme used for the highlighted areas. Defaults to PINK_GREEN for Integrated Gradients attribution, which shows positive attributions in green and negative in pink. Defaults to VIRIDIS for XRAI attribution, which highlights the most influential regions in yellow and the least influential in blue. Corresponds to the JSON property colorMap

Returns:

  • (String)


5087
5088
5089
# File 'lib/google/apis/language_v2/classes.rb', line 5087

def color_map
  @color_map
end

#overlay_typeString

How the original image is displayed in the visualization. Adjusting the overlay can help increase visual clarity if the original image makes it difficult to view the visualization. Defaults to NONE. Corresponds to the JSON property overlayType

Returns:

  • (String)


5094
5095
5096
# File 'lib/google/apis/language_v2/classes.rb', line 5094

def overlay_type
  @overlay_type
end

#polarityString

Whether to only highlight pixels with positive contributions, negative or both. Defaults to POSITIVE. Corresponds to the JSON property polarity

Returns:

  • (String)


5100
5101
5102
# File 'lib/google/apis/language_v2/classes.rb', line 5100

def polarity
  @polarity
end

#typeString

Type of the image visualization. Only applicable to Integrated Gradients attribution. OUTLINES shows regions of attribution, while PIXELS shows per- pixel attribution. Defaults to OUTLINES. Corresponds to the JSON property type

Returns:

  • (String)


5107
5108
5109
# File 'lib/google/apis/language_v2/classes.rb', line 5107

def type
  @type
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



5114
5115
5116
5117
5118
5119
5120
5121
# File 'lib/google/apis/language_v2/classes.rb', line 5114

def update!(**args)
  @clip_percent_lowerbound = args[:clip_percent_lowerbound] if args.key?(:clip_percent_lowerbound)
  @clip_percent_upperbound = args[:clip_percent_upperbound] if args.key?(:clip_percent_upperbound)
  @color_map = args[:color_map] if args.key?(:color_map)
  @overlay_type = args[:overlay_type] if args.key?(:overlay_type)
  @polarity = args[:polarity] if args.key?(:polarity)
  @type = args[:type] if args.key?(:type)
end