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

    You're on the right track with your code! In order to address the concern about the "none" distortion always having a quality of 100, you can update your dataset to map the "none" distortion to "100" level.

    Here's your updated code:

    # Find distortions and categories
    # Image number 
    subset_data$ImageNumber <- gsub("^\\D*([0-9]+)_.*$", "\\1", subset_data$image)
    
    # Extract letters following the first underscore until a second underscore or ".jpg" is encountered
    subset_data$distortion <- gsub("^[^_]+_(.*?)(_[^_]+\\.jpg|\\.jpg)$", "\\1", subset_data$image)
    
    # Convert "original" to "none" 
    subset_data$distortion[subset_data$distortion == "original"] <- "none"
    
    # Extract last set of digits immediately followed by ".jpg" for each filename
    subset_data$level <- gsub(".*_([0-9]+)\\.jpg$", "\\1", subset_data$image)
    
    # Map "none" distortion to "100" level
    subset_data$level[subset_data$distortion == "none"] <- "100"
    
    # Convert cases that are not "70", "80", or "90" to "100" 
    subset_data$level[!subset_data$level %in% c("70", "80", "90", "100")] <- "100"
    
    # Factor variables
    subset_data$distortion <- factor(subset_data$distortion, levels = c("none", "jpeg", "blur", "contrast"))
    subset_data$level <- factor(subset_data$level, levels = c("100", "90", "80", "70"))
    
    # BRMS model 
    model <- brm(ratings ~ distortion*level, data = subset_data, iter = 2000, 
                 family = gaussian, chains = 4)
    

    This code will ensure the "none" distortion has a quality level of "100" and all possible combinations in the dataset are accounted for.

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