Skip to content
The Chat Archive
gpt-4-0314· OpenAI WildChat-4.8M (AI2)

subsetdata$image [1] "images/470blur80.jpg" "images/440contrast70.jpg"…

  1. User

    subset_data$image [1] "images/470_blur_80.jpg" "images/440_contrast_70.jpg" "images/382_contrast_90.jpg" "images/9_jpeg_80.jpg" "images/288_jpeg_80.jpg" "images/115_contrast_70.jpg" "images/113_contrast_70.jpg" "images/228_contrast_70.jpg" "images/180_contrast_90.jpg" "images/227_contrast_90.jpg" [11] "images/467_blur_80.jpg" "images/100_jpeg_70.jpg" "images/147_contrast_70.jpg" "images/216_contrast_70.jpg" "images/469_jpeg_70.jpg" "images/277_contrast_90.jpg" "images/536_jpeg_70.jpg" "images/39_original.jpg" "images/65_jpeg_80.jpg" "images/396_jpeg_70.jpg"
    [21] "images/475_jpeg_80.jpg" "images/345_blur_70.jpg" "images/51_blur_80.jpg" "images/226_blur_70.jpg" "images/233_jpeg_90.jpg" "images/177_blur_70.jpg" "images/10_jpeg_80.jpg" "images/149_blur_90.jpg" "images/328_blur_70.jpg" "images/190_contrast_90.jpg"

    I have shown images either in their original state or with "jpeg", "blur" or "contrast" distortion. If the images are distorted the can be distorted at levels "70", "80 or "90" which represents how many percentage of the original quality they are expected to have (SSIM). How can I elegantly separate the image into its different category names using the image name? Also propose BRMS models to predict another variable called ratings from the nested combination of image distortions and levels. Here is a first attempt:

    Find distortions and categories

    Image number

    subset_dataImageNumber <- gsub("^\\D*([0-9]+)_.*", "\1", subset_data$image)

    Extract letters following the first underscore until a second underscore or ".jpg" is encountered

    subset_datadistortion <- gsub("^[^_]+_(.*?)(_[^_]+\\.jpg|\\.jpg)", "\1", subset_data$image)

    Convert "original" to "none"

    subset_datadistortion[subsetdatadistortion[subset_datadistortion == "original"] <- "none"

    Extract last set of digits immediately followed by ".jpg" for each filename

    subset_datalevel<−gsub(".∗([0−9]+).jpglevel <- gsub(".*_([0-9]+)\\.jpg", "\1", subset_data$image)

    Convert cases that are not "70", "80", or "90" to "100"

    subset_datalevel[!subsetdatalevel[!subset_datalevel %in% c("70", "80", "90")] <- "100"

    Factor variables

    subset_datadistortion<−factor(subsetdatadistortion <- factor(subset_datadistortion, levels = c("none", "jpeg", "blur", "contrast")) subset_datalevel<−factor(subsetdatalevel <- factor(subset_datalevel, levels = c("100", "90", "80", "70"))

    BRMS model

    model <- brm(ratings ~ distortion*level, data = subset_data, iter = 2000, family = gaussian, chains = 4)

    One issue with this attempt is that it assumes that all distortion * level options are possible, but none will always have a quality of 100

  2. Assistant

    To adjust for the fact that none will always have a quality of 100, you can create a new variable that combines distortion and level, and then use this variable as a predictor in the BRMS model.

    # Create a combined variable for distortion and level
    subset_data$distortion_level <- interaction(subset_data$distortion, subset_data$level)
    
    # Remove unused levels
    subset_data$distortion_level <- droplevels(subset_data$distortion_level)
    
    # Adjust for "none" distortion
    subset_data$distortion_level <- relevel(subset_data$distortion_level, ref="none.100")
    
    # BRMS model
    model <- brm(ratings ~ distortion_level, data = subset_data, iter = 2000, 
                 family = gaussian, chains = 4)
    

    This way, the model will only consider the specific combinations of distortion and level that are present in the data. The relevel function is used to set "none.100" as the reference level, since it represents the original undistorted image quality.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.