/* *
	File:		compat.c
	Author:      Merle Romesberg
    Created:     1999
    Description: Enables compatible files to be used together.
					ie training / validation sets with the same value numbering system
    Copyright 1999, SPR
*/

#ifndef COMPAT_H
#define COMPAT_H
#include "ds.h"

/*make attnum of ds have values from in value_names
  PRE: value_names must be a superset of previous names 
	   and must be sorted.                              */
void ds_new_value_names(datset *ds, int attnum, string_array *value_names);

/* modify the two data sets so 
   each attribute has the same set of possible values */
void ds_compat(datset *train, datset *test, bool rename_test_atts, 
	       char **r_errmess);

/* Two atts have the same shape iff

     They're both real-valued

         or

     They're both symbolic with the same arity and each of their
     values has the same name (in the same order).

   The attributes themselves do NOT need to have the same name
   in order to have the same shape. */
bool ds_attnums_have_same_shape(datset *ds1,int attnum1,
                                datset *ds2,int attnum2);

/* This makes the specified attributes in the two datasets have
   the same shape (by the defintion of shape used in
   ds_attnums_have_same_shape() above. It does not rename
   either attribute.  */
void ds_compat_attribute(datset *train, int train_attnum, 
			 datset *test, int test_attnum,
			 bool rename_ok,
			 char **r_errmess);

/* this is like ds_compat_attribute only different.  there no attempt to
   make the attribute names match.  there is no attempt to handle real values.
   it merely makes the symbolic value lists match (presumably so they can be
   joined in some way.
   */
void ds_compat_symbolic_attribute_values(datset *train, int train_attnum, 
					 datset *test, int test_attnum,
					 char **r_errmess);


#endif
